/*
Fish Jumping
Dylan Kuehl
jumpingfish.t
This program will draw a jumping fish.
*/
setscreen ("graphics:600;400,offscreenonly")
var fish : int := Pic.FileNew ("fishy.bmp") %level fish
var upfish : array 0..45 of int
var downfish : array 0..45 of int
var water : int := Pic.FileNew ("water.bmp") %water
var fishx, fishy : int := 0%location coordinates
var x : int := 0
colorback (43)
cls
procedure bgdraw %begins background procedure
for i : 0..400 by 200
Pic.Draw (water, i, 0, picMerge) %draws water bg onto screen
end for
Draw.FillOval (50, 350, 50, 50, brightred) %draws sun
end bgdraw
procedure rotateup
x := 0
for decreasing o : -1..-45
cls
bgdraw
x := x + 1
upfish (x) := Pic.Rotate (fish, o, 100, 100)
Pic.Draw (upfish (x), fishx, fishy, picMerge)
View.Update
end for
end rotateup
procedure rotatedown
x := 0
for p : 1..45
x := x + 1
downfish (x) := Pic.Rotate (fish, p, 100, 100)
end for
end rotatedown
bgdraw
fishx := 425
fishy := 25
Pic.Draw (fish, fishx, fishy, picMerge)
View.Update
rotateup
loop
cls
bgdraw
Pic.Draw (upfish (45), fishx, fishy, picMerge)
fishx := fishx - 1
fishy := fishy + 2
View.Update
exit when fishx = 325 and fishy = 225
end loop
for decreasing y : 45 .. 1
cls
bgdraw
Pic.Draw (upfish (y), fishx, fishy, picMerge)
fishx := fishx - 1
View.Update
end for
for t : 1..44
cls
bgdraw
[color=orange]Pic.Draw (downfish (t), fishx, fishy, picMerge)[/color]
fishx := fishx - 1
View.Update
end for
|