-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameObject.py
36 lines (29 loc) · 1006 Bytes
/
GameObject.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
from support_functions import *
class GameObject:
def __init__(self, color, x_y, width_height, vx_vy, hp, dm, endurance):
self.color = color
self.x, self.y = x_y
self.vx, self.vy = vx_vy
self.width, self.height = width_height
self.hp = hp
self.dm = dm
self.endurance = endurance
self.direction = ""
def move(self):
if not_in_border(self.x, self.y, self.direction):
if self.direction == "left":
self.x -= self.vx * dt()
if self.direction == "right":
self.x += self.vx * dt()
if self.direction == "down":
self.y += self.vy * dt()
if self.direction == "up":
self.y -= self.vy * dt()
def shoot(self, other):
pass
def get_damage(self, dm):
self.hp -= dm * self.endurance
def draw(self, screen):
pass
def collision(self, other):
pass