import pygame

WIDTH = 1000
HEIGHT = 800

pygame.init()

window = pygame.display.set_mode((WIDTH, HEIGHT))
window.fill((144, 228, 144))

pygame.display.set_caption("Fish")
clock = pygame.time.Clock()

water = pygame.image.load("./images/background_terrain.png")
water = pygame.transform.scale(water,(WIDTH,HEIGHT))

all_colors = ["blue"]

fish_images = {"blue": pygame.image.load("./images/fish_blue_outline.png")}
fish_x_positions = {"blue": 0}
fish_y_positions = {"blue": 0}
fish_speeds = {"blue": 2}

def draw_background():
    window.blit(water,(0,0))
    
def update_one_fish(color):
    x = fish_x_positions[color]
    speed = fish_speeds[color]
    fish_x_positions[color] = x + speed 
    
def draw_one_fish(color):
    x = fish_x_positions[color]
    y = fish_y_positions[color]
    image = fish_images[color]
    window.blit(image, (x,y))     
    
def move_fish():
    for color in all_colors:
        update_one_fish(color)
        draw_one_fish(color)
        
def redraw():
    draw_background()
    move_fish()
    pygame.display.update()

def run_app():
    app_is_running = True
    while app_is_running == True:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_q:
                    app_is_running = False                    
        redraw()
        clock.tick(30)
    pygame.quit()

run_app()