wip
This commit is contained in:
parent
70332388e8
commit
eba8fd76fe
1 changed files with 7 additions and 7 deletions
|
|
@ -17,8 +17,8 @@ def run():
|
||||||
image_rect = image1.get_rect()
|
image_rect = image1.get_rect()
|
||||||
|
|
||||||
# Set the initial position of the image
|
# Set the initial position of the image
|
||||||
image_rect.x = 0
|
image_rect.x = 350
|
||||||
image_rect.y = 0
|
image_rect.y = 250
|
||||||
movement_speed = 0.5
|
movement_speed = 0.5
|
||||||
|
|
||||||
# Set the animation speed
|
# Set the animation speed
|
||||||
|
|
@ -52,16 +52,16 @@ def run():
|
||||||
|
|
||||||
# Animate the image if the player is moving
|
# Animate the image if the player is moving
|
||||||
if (
|
if (
|
||||||
pressed[pygame.K_w] or
|
pressed[pygame.K_w]
|
||||||
pressed[pygame.K_a] or
|
or pressed[pygame.K_a]
|
||||||
pressed[pygame.K_s] or
|
or pressed[pygame.K_s]
|
||||||
pressed[pygame.K_d]
|
or pressed[pygame.K_d]
|
||||||
):
|
):
|
||||||
animation_frame += animation_speed
|
animation_frame += animation_speed
|
||||||
if animation_frame >= 2:
|
if animation_frame >= 2:
|
||||||
animation_frame = 0
|
animation_frame = 0
|
||||||
|
|
||||||
image_rect.x += movement_speed + 1
|
image_rect.x += movement_speed
|
||||||
|
|
||||||
# Draw the image on the screen
|
# Draw the image on the screen
|
||||||
screen.fill((0, 0, 0))
|
screen.fill((0, 0, 0))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue