Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.

Commit 041262d

Browse files
committed
2 parents faefd6a + 28e219e commit 041262d

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

Character.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,28 @@ def character_surf_initialize():
7272
bullet_surf[name] = surf
7373

7474
def update_img(entity, direction):
75-
if (time.time() - entity.walking_cd) > 0.25:
76-
#print('updating')
77-
entity.walking_cd = time.time()
78-
if direction != [0, 0]:
79-
if entity.images['now'] == 'walking_1':
80-
#print('change to walking_2')
81-
entity.images['now'] = 'walking_2'
82-
if direction[0] > 0:
83-
entity.surf = entity.surf_dict['walking_2']
84-
else:
85-
entity.surf = entity.surf_dict['walking_2_reverse']
86-
else:
87-
entity.images['now'] = 'walking_1'
88-
#print('change to walking_1')
89-
if direction[0] > 0:
90-
entity.surf = entity.surf_dict['walking_1']
91-
else:
92-
entity.surf = entity.surf_dict['walking_1_reverse']
75+
if time.time() - entity.walking_cd <= 0.25:
76+
return
77+
#print('updating')
78+
entity.walking_cd = time.time()
79+
if direction == [0, 0]:
80+
entity.surf = entity.surf_dict['standing']
81+
entity.images['now'] = 'standing'
82+
83+
elif entity.images['now'] == 'walking_1':
84+
#print('change to walking_2')
85+
entity.images['now'] = 'walking_2'
86+
if direction[0] > 0:
87+
entity.surf = entity.surf_dict['walking_2']
88+
else:
89+
entity.surf = entity.surf_dict['walking_2_reverse']
90+
else:
91+
entity.images['now'] = 'walking_1'
92+
#print('change to walking_1')
93+
if direction[0] > 0:
94+
entity.surf = entity.surf_dict['walking_1']
9395
else:
94-
entity.surf = entity.surf_dict['standing']
95-
entity.images['now'] = 'standing'
96+
entity.surf = entity.surf_dict['walking_1_reverse']
9697

9798

9899
def update_bullet_image_direction(image, direction):

0 commit comments

Comments
 (0)