-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.py
More file actions
38 lines (30 loc) · 1.09 KB
/
Copy pathplayer.py
File metadata and controls
38 lines (30 loc) · 1.09 KB
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
37
38
import pygame
import animation
# crer une première classe qui va représenter notre joueur
class Player(animation.AnimateSprite):
#on crée une première méthode
def __init__(self):
#on initialise la super classe
super().__init__("player")
self._status='idle'
self.health = 100
self.max_health = 100
self.attack = 10
self.velocity = 10
#self.image = pygame.transform.scale(pygame.image.load('assets/player/idle/playerIdle_000.png'),(200,200))
#on veut récuérer les coordonnées de l'image pour pouvoir la déplacer
self.rect = self.image.get_rect()
self.rect.x = 80
self.rect.y = 550
self.start_animation('idle')
def _get_status(self):
return self._status
def _set_status(self,status):
self._status = status
def move_right(self):
self.rect.x += self.velocity
self.start_animation('run')
def move_left(self):
self.rect.x -= self.velocity
def update_animation(self,dt):
self.animate(dt)