Skip to content

Instantly share code, notes, and snippets.

@berdyshev
Created May 2, 2026 11:12
Show Gist options
  • Select an option

  • Save berdyshev/c95754a244bd8416c18b47bc133f6b3a to your computer and use it in GitHub Desktop.

Select an option

Save berdyshev/c95754a244bd8416c18b47bc133f6b3a to your computer and use it in GitHub Desktop.
import pgzrun
WIDTH = 640
HEIGHT = 480
speed = 5
fish = Actor('sea3')
fish.pos = (320, 200)
def draw():
screen.fill("steelblue")
screen.draw.filled_rect(Rect((0, 400), (640, 80)), "tan")
fish.draw()
def update():
if keyboard.right:
fish.x += speed
fish.flip_x = True
if keyboard.left:
fish.x -= speed
fish.flip_x = False
if keyboard.up:
fish.y -= speed
if keyboard.down:
fish.y += speed
if fish.x < 50: fish.x = 50
if fish.x > 600: fish.x = 600
if fish.y < 50: fish.y = 50
if fish.y > 360: fish.y = 360
pgzrun.go()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment