This commit is contained in:
Waylon Walker 2023-01-28 10:48:51 -06:00
parent 70332388e8
commit eba8fd76fe
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4

View file

@ -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))