Hello Everyone!
I have been using Pythonista and Eitorial for some time now and nytime i ad an issue i would usually find a solution, or path to one, here with yall. After all this time i cannot find an nswer anywhere.. the net is flooded with pygame but i only use iPad air2 and iPhone6s.
Heres what i got..
- i have a Core class that every other class inherits from. this has info such as
- Device info
- Global setting such as Scaling for Retina, screen resolution...
- Update, start and awake methods fore init order control. (update does nothing currently)
- and so on..
i need the update method to sync with game loop so all objects have the same timing. i know i can do the folowing...
from scene import *
A = Action
class GameObject(Node):
def __init__(self, *args, **kwargs):
#Node.__init__(self, *args, **kwargs)
self.position = Point(10, 10)
self.velocity = 30
def update(self, dt):
self.position= (self.position[0] + self.velocity * dt,
self.position[1] + self.velocity * dt,)
class GameLoop (Scene):
def setup(self):
self.go = GameObject()
self.add_child(self.go)
def update(self):
self.go.update(self.dt)
.
if __name__ == '__main__':
run(GameLoop(), show_fps=False)
but i fel that doing so for all gameobjects is a bad idea lol..
example above is just that lol i think its silly but best Example i could come up with.
I thought of trying to make a metaclass that runs a loop but i'm not sure how that structure would work.
Any Help is VERY much appreciated!
P.S. Pythonista is a wonderful App and has help myself get through alot lately. please keep it going and keep up the outstanding work @omz!