import icons

background=Rectangle(color=["skyblue","paleturquoise","aquamarine","darkturquoise","midnightblue"]) 

def SeaFish(width, p1, p2, color="honeydew"):
    fish=icons.Fish(width=width, height=width,y=p1,x=100-p2,color=color)
    points=[(p1,p2),(p2,p1),(p1,100-p2),(100-p2,p1)]
    return(fish,points)

def SwimLocation(fish,p):
	fish.x=p[0]
	fish.y=p[1]

def SwimDir(counter,x,y):
    if counter<1 :
        if x>y:
			icons.fish.flip_horizontal()
    if counter<>0:
        if PrevX>x:
            icons.fish.flip_horizontal()
	PrevX=x
        
    
fish1, fish1_points=SeaFish(30,10,20, color=["blue","yellow","white","orange"])
fish2,fish2_points=SeaFish(10,30,10,color=["orange","white"])
fish3, fish3_points=SeaFish(15,20,10,color=["white","blue","white"])
fish4, fish4_points=SeaFish(20,51,10,color=["red","white"])

for i in range(len(fish1_points)):
	with animation(duration=4):
		SwimLocation(fish1, fish1_points[i])
		SwimLocation(fish2, fish2_points[i])
		SwimLocation(fish3, fish3_points[i])
		SwimLocation(fish4, fish4_points[i])

Merrilyn's Fishes

by merrilyn

Created 4 years, 4 months ago.