implementation of SEQSID
parent
06fbfa4051
commit
d8b2a9f69d
|
@ -200,6 +200,14 @@ class camera(obj):
|
|||
if self.mode == cammode.follow and self.subject:
|
||||
self.position = self.subject.position
|
||||
|
||||
class seqobj:
|
||||
def __init__(self, objects):
|
||||
self._objects = objects
|
||||
|
||||
def moveby(self, pos):
|
||||
for i in self._objects:
|
||||
i.position + pos
|
||||
|
||||
class game:
|
||||
def __init__(self, size=[10, 10], renderer=stdrend, sounddir=""):
|
||||
if renderer == None: raise TypeError("Renderer class needed!")
|
||||
|
@ -212,6 +220,7 @@ class game:
|
|||
self._size = size
|
||||
self._objects = {}
|
||||
self._SIDS = {}
|
||||
self._SEQSIDS = {}
|
||||
self.camera = camera()
|
||||
self._renderer = renderer(size, self.camera)
|
||||
self._threads = []
|
||||
|
@ -219,6 +228,12 @@ class game:
|
|||
def getobjbySID(self, target):
|
||||
return self._objects[self._SIDS[target]]
|
||||
|
||||
def getobjseqbySID(self, target):
|
||||
out = []
|
||||
for i in self._SEQSIDS[target]:
|
||||
out.append(self._objects[i])
|
||||
return seqobj(out)
|
||||
|
||||
def isdown(self, key):
|
||||
temp = self._renderer.getkeys()
|
||||
if key in temp:
|
||||
|
|
20
main.py
20
main.py
|
@ -1,5 +1,5 @@
|
|||
import sys
|
||||
# Justus Jan Nico Wolff last updated on 24.05.2024 at 1AM bruh
|
||||
# Justus Jan Nico Wolff
|
||||
sys.dont_write_bytecode = True
|
||||
import mtTkinter as tk
|
||||
from tkinter import ttk as tkk
|
||||
|
@ -339,6 +339,13 @@ def changemodelpos(event):
|
|||
atritree.delete(*atritree.get_children())
|
||||
atritree.insert("", index=tk.END, text="x", tags=("OA",))
|
||||
atritree.insert("", index=tk.END, text="y", tags=("OA",))
|
||||
atritree.insert("", index=tk.END, text="SEQSID", values=(calcseqsid(objtree.focus())), tags=("SID",))
|
||||
|
||||
def calcseqsid(target):
|
||||
out = ""
|
||||
for f in objtree.get_children(target):
|
||||
out = out + gamedata[f]["SID"][:5]
|
||||
return out
|
||||
|
||||
def rpopup(event):
|
||||
try:
|
||||
|
@ -610,11 +617,22 @@ def run():
|
|||
i = gamedata[i]
|
||||
if i["id"] != "sound" and i["id"] != "rawsound": continue
|
||||
maingame.sounds[i["args"]["spath"]] = i["args"]["sdata"]
|
||||
skip = []
|
||||
for i in gamedata:
|
||||
GID = i
|
||||
i = gamedata[i]
|
||||
if i["id"] != "obj": continue
|
||||
objid = i["args"]["ID"]
|
||||
maingame._SIDS[i["SID"]] = objid
|
||||
if objtree.parent(GID) != "" and not objtree.parent(GID) in skip:
|
||||
skip.append(objtree.parent(GID))
|
||||
out = ""
|
||||
out2 = []
|
||||
for f in objtree.get_children(objtree.parent(GID)):
|
||||
out = out + gamedata[f]["SID"][:5]
|
||||
out2.append(f)
|
||||
maingame._SEQSIDS[out] = out2
|
||||
|
||||
maingame._objects = copy.deepcopy(preview._objects)
|
||||
"""
|
||||
objects = copy.deepcopy(preview._objects)
|
||||
|
|
|
@ -44,6 +44,13 @@ to safely access an Object (no failsafes tho) you can use HASHGAME.getobjbyid(\<
|
|||
SID's are ID's of objects that always stay the same. You can view the SID of an object under the HASHENGINE editor under an object's attributes. Double click on the SID attribute to copy the SID to your clipboard.
|
||||
Now to access an object trough it's SID use HASHGAME.getobjbySID(\<SID>) this will return the object class.
|
||||
|
||||
#### SEQSID's
|
||||
|
||||
SEQSID's are ID's of an "model" that was created in the HASHENGINE editor, it is calculated by putting every 1-5 fifth character of every object in the model into one string. Double click on the SEQSID attribute to copy the SID to your clipboard.
|
||||
To access object's trough an SEQSID use HASHGAME.getobjseqbySID(\<SEQSID>), this will return an seqobj class.
|
||||
the seqobj class can do one single thing: move objects by an specified offset. that means, use \<SEQOBJ>.moveby(\<POS>).
|
||||
this will move every object of that SEQSID by that offset.
|
||||
|
||||
to add an Object to the running game use HASHGAME.addobj(\<target object>).
|
||||
to remove an object from the running game use HASHGAME.removeobj(\<target object class>) or HASHGAME.removeobjbyid(\<ID>).
|
||||
|
||||
|
|
Loading…
Reference in New Issue