Added Entity.
[krufty_fps.git] / demo / Entity.py
blobdd397e99d9432acc60e718ddafc56002061a0ed7
1 #!/usr/bin/python
2 # this is the Entity class
4 from Dice3DS import *
6 def main():
7 print "Entity class...more documentation to come"
9 class Entity:
11 def __init__(self, engine, specs):
13 self.functions = {}
15 if specs.has_key('script'):
16 try:
17 self.script = engine.readZipfile(specs['script'])
18 exec(self.script)
19 except:
20 print "Entity.__init__(): Couldn't find/exec script"
22 assert specs.has_key('name')
23 self.name = specs['name']
25 if specs.has_key('model'):
26 #try:
27 self.data = read_3ds_mem(engine.readZipfile(specs['model']), 1, 1)
28 #except:
29 # print "Entity.__init__(): Error reading model"
31 def draw(self, engine):
33 # implement this
35 return
37 def event(self, event, data):
39 if self.functions.has_key(event):
40 try:
41 self.functions[event](data)
42 except:
43 print "Entity.event(): Error running event callback"
45 return
47 if __name__ == '__main__': main()