-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathplayer_sprite.py
More file actions
32 lines (25 loc) · 827 Bytes
/
player_sprite.py
File metadata and controls
32 lines (25 loc) · 827 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
import arcade
from rpg.sprites.character_sprite import CharacterSprite
class PlayerSprite(CharacterSprite):
def __init__(self, sheet_name):
super().__init__(sheet_name)
self.sound_update = 0
self.footstep_sound = arcade.load_sound(":sounds:footstep00.wav")
self.set_hit_box(
[
(8, 0),
(8, -16),
(-8, -16),
(-8, 0)
]
)
def on_update(self, delta_time):
super().on_update(delta_time)
if not self.change_x and not self.change_y:
self.sound_update = 0
return
if self.should_update > 3:
self.sound_update += 1
if self.sound_update >= 3:
arcade.play_sound(self.footstep_sound)
self.sound_update = 0