-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameObjects.py
36 lines (35 loc) · 1 KB
/
GameObjects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Room:
# init, base class sets up room's entity list
def __init__(self):
self.entities = []
# update loop, base class calls update() of each entity in room
def update(self):
for entity in self.entities:
entity.update()
# draw event, base class calls draw() of each entity in room
def draw(self):
for entity in self.entities:
entity.draw()
# called when room starts, typically create initial entities here
def roomStart(self):
pass
# called when room ends, base class clears room's entity list
def roomEnd(self):
self.entities = []
class Entity:
# init, base class stores entity's coordinates
def __init__(self, x=0, y=0):
self.x = x
self.y = y
# create event, called when instance makes it out of the instance creation queue
def create(self):
pass
# update loop
def update(self):
pass
# destroy event, called when instance makes it out of the instance removal queue
def destroy(self):
pass
# draw event
def draw(self):
pass