def on_update(cls, dt: float): cls.dt = dt while not cls.callableQueue.empty(): callable = cls.callableQueue.get() callable() for gameObject in cls.gameObjects: for script in gameObject.scripts: script.onUpdate() from gameengine.managers.CameraManager import CameraManager for camera in CameraManager().collection: for script in camera.scripts: script.onUpdate() from gameengine.managers.PhysicsManager import PhysicsManager PhysicsManager().onUpdate(dt) from gameengine.managers.CollisionManager import CollisionManager CollisionManager().onUpdate(dt) Timer.tick() for gameObject in cls.gameObjects.copy(): for script in gameObject.scripts: script.onLateUpdate() from gameengine.managers.CameraManager import CameraManager for camera in CameraManager().collection: for script in camera.scripts: script.onLateUpdate() cls.frameCount += 1
from gameengine.core.Timer import Timer from time import sleep def fun1(text): print(text) t1 = Timer.add(fun1, ("1"), 1000, 500, 3) t2 = Timer.add(fun1, ("2"), 750, 500, -1) t3 = Timer.add(fun1, ("3"), 100, 1000, 1) t4 = Timer.add(fun1, ("2"), 750, 500, -1) Timer.remove(t4) while True: Timer.tick() sleep(0.01)