Added movement via LEFT and RIGHT arrow keys.

This commit is contained in:
justin committed 2025-07-14 12:47:15 -07:00
1 parent a7fc2c5a69
commit edaeb045a6
4 files changed
+4 -4

No files matched your search

+4 -4
View File
@@ -164,11 +164,11 @@ class Game:
self.cat_right_base = pygame.image.load("cat.png").convert_alpha()
self.sushi_images = []
for i in [1, 2, 4, 5]:
for i in [1, 2, 4, 3]: # sushi5.png renamed to sushi3.png
img = pygame.image.load(f"sushi{i}.png").convert_alpha()
img = pygame.transform.smoothscale(img, SUSHI_SIZE)
self.sushi_images.append(img)
self.wasabi_img = pygame.image.load("sushi3.png").convert_alpha()
self.wasabi_img = pygame.image.load("wasabi.png").convert_alpha() # sushi3.png renamed to wasabi.png
self.wasabi_img = pygame.transform.smoothscale(self.wasabi_img, SUSHI_SIZE)
self.cloud_base = pygame.image.load("cloud.png").convert_alpha()
@@ -368,10 +368,10 @@ class Game:
if not self.game_over:
# Handle input
if keys[pygame.K_a]:
if keys[pygame.K_a] or keys[pygame.K_LEFT]:
move = -1
self.cat.facing = "left"
elif keys[pygame.K_d]:
elif keys[pygame.K_d] or keys[pygame.K_RIGHT]:
move = 1
self.cat.facing = "right"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB