-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZombie.py
More file actions
36 lines (25 loc) · 969 Bytes
/
Zombie.py
File metadata and controls
36 lines (25 loc) · 969 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
26
27
28
29
30
31
32
33
34
35
36
from math import sqrt
from Human import Human
class Zombie(Human):
"""This is the Predator that will move around the area. y-axis points DOWN"""
zombiePosX = 0
zombiePosY = 0
def __init__(self, rect=None, color=None, deathSound=None):
Human.__init__(self, rect, color, deathSound)
def swim(self, area, mousePos_x, mousePos_y):
"""Using my xVel and yVel values, take a step, so long as we don't swim out of bounds."""
if mousePos_x <= 0:
zombiePosX = 0
elif mousePos_x >= area.width:
zombiePosX = area.width
else:
zombiePosX = mousePos_x
if mousePos_y <= 0:
zombiePosY = 0
elif mousePos_y >= area.height:
zombiePosY = area.height
else:
zombiePosY = mousePos_y
#print("x: "+str(pozycja_ryby_x) + " y: "+str(pozycja_ryby_y))
self.rect[0]=zombiePosX
self.rect[1]=zombiePosY