Some work.
[krufty_fps.git] / demo / Entity.py
blobf4caa58cf9415dd6507f0689ca45843e89f1bbab
1 #!/usr/bin/python
2 # this is the Entity class
4 def main():
5 print "Entity class...more documentation to come"
7 class Entity:
9 def __init__(self, engine, specs):
11 self.functions = {}
13 if specs.has_key('script') and specs['script'] != []:
14 try:
15 self.script = engine.readZipfile(specs['script'])
16 exec(self.script)
17 except:
18 print "Entity.__init__(): Couldn't find/exec script"
20 assert specs.has_key('contents')
21 self.name = specs['contents']
23 self.engine = engine
25 self.data = None
26 self.model = None
28 def draw(self, engine):
30 if self.data == None:
31 return
33 return
35 def event(self, event, data):
37 if self.functions.has_key(event):
38 #try:
39 self.functions[event](self, data)
40 #except:
41 # print "Entity.event(): Error running event callback"
43 return
45 if __name__ == '__main__': main()