-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.py
More file actions
26 lines (23 loc) · 943 Bytes
/
entity.py
File metadata and controls
26 lines (23 loc) · 943 Bytes
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
class Entity:
def __init__(self, entityType, x, y, active):
self.entityType = entityType
self.x = x
self.y = y
self.active = active
self.collisionObj = None
self.image = None
#exit attributes
self.exitScreen = None
self.exitDirection = None
def SetAttributes(self, attributes):
if self.entityType.name == "exit":
self.exitScreen = attributes.split()[0] + "Data"
self.exitDirection = attributes.split()[1]
if self.exitDirection == "up":
self.collisionObj.shape.position.y += 32
if self.exitDirection == "right":
self.collisionObj.shape.position.x += 32
if self.exitDirection == "down":
self.collisionObj.shape.position.y -= 32
if self.exitDirection == "left":
self.collisionObj.shape.position.x -= 32