-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.py
26 lines (22 loc) · 817 Bytes
/
player.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
from constants import *
class Player():
def __init__(self, x, y, width, height, speed_x=0.1, jumping_height=100, jumping_time=0.1, color=Color.RED.value, keys=['up', 'down', 'left', 'right'], name='player_1'):
self.x = x
self.y = y
self.dx = 0
self.dy = 0
self.width = width
self.height = height
self.speed_x = speed_x
self.jumping_height = jumping_height
self.jumping_time = jumping_time
self.color = color
self.keys = keys
self.name = name
self.can_jump = False
self.jumping = False
self.nb_jumping_frame = 0
self.is_down = False
self.is_buff_jump = False
def __str__(self):
return f"{self.name} : \n x,y : [{self.x},{self.y}]\n dx,dy : [{self.dx},{self.dy}]"