-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene_chars.py
33 lines (27 loc) · 961 Bytes
/
scene_chars.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
# Scripts:
from character import Character
# Modules:
class SceneChar(Character):
def __init__(self, category, img_path, scale, start_pos, vel, final_pos, hp):
super().__init__(category, img_path, scale, vel, hp)
# Image:
self.start_pos = start_pos
self.rect.center = self.start_pos
# Start Movement Animation:
self.start_animation = True
self.start_pos_x = self.start_pos[0]
# End Movement Animation:
self.final_pos = final_pos
def animate_start(self):
if self.start_pos_x < self.final_pos:
if self.rect.x < self.final_pos:
self.rect.x += self.vel_x
else:
self.start_animation = False
else:
if self.rect.x > self.final_pos:
self.rect.x += self.vel_x
else:
self.start_animation = False
def animate_end(self):
self.rect.x -= self.vel_x