this was supposed to be space invaders, but i changed some stuff and made it this LOL
again, my first turing project. also, the frog doeesnt always respond to the oncoming objects, sometimes you have to hit them a certain way, like directly in centre or at an angle or something. again, please suggest ways of improvement. thanks to all.
HERE IT IS: | Turing: |
import GUI
var row : int
row := 19
var x1 := 300
var y1 := 1
var x2 := 290
var x3 := 310
var x4 := 300
var y2 := 20
var y3 := 19
var y4 := 18
var y5 := 17
var y11: = 16
var y12: = 15
var y13: = 14
var y14: = 13
var y15: = 12
var y16: = 11
var y17: = 10
var x6 := 600
var x7 := 700
var x8 := 800
var y6 := 200
var y7 := 0
var y8 := 300
var y9 := 0
var y10 := 400
var getkey : array char of boolean
var answer : string
var count: int:= 3
procedure oval
x6 := x6 - 10
delay (10)
end oval
loop
x1 := 300
y1 := 1
x2 := 290
x3 := 310
x4 := 300
y2 := 20
y3 := 19
y4 := 18
y5 := 17
y11: = 16
y12: = 15
y13: = 14
y14: = 13
y15: = 12
y16: = 11
y17: = 10
x6 := 600
x7 := 700
x8 := 800
y6 := 200
y7 := 0
y8 := 300
y9 := 0
y10 := 400
count: = count
loop
drawfillbox (1, 100, 800, 350, black)
drawfillbox (10, 225, 80, 220, white)
drawfillbox (100, 225, 180, 220, white)
drawfillbox (200, 225, 280, 220, white)
drawfillbox (300, 225, 380, 220, white)
drawfillbox (400, 225, 480, 220, white)
drawfillbox (500, 225, 580, 220, white)
drawfillbox (600, 225, 680, 220, white)
drawfillbox (1, 600, 800, 350, green)
drawfillbox (1, 100, 800, 0, green)
drawfillarc (x1, y1, 30, 30, 360, 180, brightgreen)
drawfilloval (x2, y2, 5, 5, white)
drawfilloval (x2, y2, 3, 3, black)
drawfilloval (x3, y2, 5, 5, white)
drawfilloval (x3, y2, 3, 3, black)
drawfilloval (x4, y3, 3, 3, brightgreen)
drawfilloval (x4, y4, 3, 3, brightgreen)
drawfilloval (x4, y5, 3, 3, brightgreen)
drawfilloval (x4, y11, 3, 3, brightgreen)
drawfilloval (x4, y12, 3, 3, brightgreen)
drawfilloval (x4, y13, 3, 3, brightgreen)
drawfilloval (x4, y14, 3, 3, brightgreen)
drawfilloval (x4, y15, 3, 3, brightgreen)
drawfilloval (x4, y16, 3, 3, brightgreen)
drawfilloval (x4, y17, 3, 3, brightgreen)
%frog
drawfilloval (x6, y6, 20, 20, grey)
delay (1)
drawfilloval (x6, y8, 20, 20, grey)
delay (1)
%cars
if x6 = - 10 then
randint (y7, 125, 225)
randint (y9, 225, 325)
x6 := 700
y6 := y7
y8 := y9
drawfilloval (x6, y6, 25, 25, black)
end if
oval
drawfillbox (1, 100, 800, 350, black)
drawfillbox (10, 225, 80, 220, white)
drawfillbox (100, 225, 180, 220, white)
drawfillbox (200, 225, 280, 220, white)
drawfillbox (300, 225, 380, 220, white)
drawfillbox (400, 225, 480, 220, white)
drawfillbox (500, 225, 580, 220, white)
drawfillbox (600, 225, 680, 220, white)
drawfillbox (1, 600, 800, 350, green)
drawfillbox (1, 100, 800, 0, green)
Input.KeyDown (getkey )
if getkey (KEY_UP_ARROW) then
y1 := y1 + 5
y2 := y2 + 5
y3: = y3 + 5
y4: = y4 + 5
y5: = y4 + 5
y11: = y11 + 5
y12: = y12 + 5
y13: = y13 + 5
y14: = y14 + 5
y15: = y15 + 5
y16: = y16 + 5
y17: = y17 + 5
end if
if getkey (KEY_DOWN_ARROW) then
y1 := y1 - 5
y2 := y2 - 5
y3: = y3 - 5
y4: = y4 - 5
y5: = y5 - 5
y11: = y11 - 5
y12: = y12 - 5
y13: = y13 - 5
y14: = y14 - 5
y15: = y15 - 5
y16: = y16 - 5
y17: = y17 - 5
end if
if getkey (KEY_LEFT_ARROW) then
x1 := x1 - 5
x2 := x2 - 5
x3 := x3 - 5
x4: = x4 - 5
end if
if getkey (KEY_RIGHT_ARROW) then
x1 := x1 + 5
x2 := x2 + 5
x3 := x3 + 5
x4: = x4 + 5
end if
drawfillbox (1, 100, 800, 350, black)
drawfillbox (10, 225, 80, 220, white)
drawfillbox (100, 225, 180, 220, white)
drawfillbox (200, 225, 280, 220, white)
drawfillbox (300, 225, 380, 220, white)
drawfillbox (400, 225, 480, 220, white)
drawfillbox (500, 225, 580, 220, white)
drawfillbox (600, 225, 680, 220, white)
drawfillbox (1, 600, 800, 350, green)
drawfillbox (1, 100, 800, 0, green)
if y2 = 380 then
put "Complete!"
put "Congratulations, you have completed frogger beta v.01!!"
exit
end if
if x6 = x2 and y6 = y2 then
count: = count - 1
exit
elsif x6 = x2 and y8 =y2 then
count: = count - 1
exit
elsif x6 = x3 and y6 = y2 then
count: = count - 1
exit
elsif x6 = x3 and y8 = y2 then
count: = count - 1
exit
elsif x6= x4 and y6 = y3 then
count: = count - 1
exit
elsif x6= x4 and y6 = y4 then
count: = count - 1
exit
elsif x6= x4 and y8 = y3 then
count: = count - 1
exit
elsif x6= x4 and y8 = y4 then
count: = count - 1
exit
elsif x6 = x4 and y6 = y5 then
count: = count - 1
exit
elsif x6 = x4 and y8 =y5 then
count: = count - 1
exit
elsif x6 = x4 and y6 = y11 then
count: = count - 1
exit
elsif x6 = x4 and y8 = y11 then
count: = count - 1
exit
elsif x6= x4 and y6 = y12 then
count: = count - 1
exit
elsif x6= x4 and y8 = y12 then
count: = count - 1
exit
elsif x6= x4 and y6 = y13 then
count: = count - 1
exit
elsif x6= x4 and y8 = y13 then
count: = count - 1
exit
elsif x6= x4 and y6 = y14 then
count: = count - 1
exit
elsif x6= x4 and y8 = y14 then
count: = count - 1
exit
elsif x6= x4 and y6 = y15 then
count: = count - 1
exit
elsif x6= x4 and y8 = y15 then
count: = count - 1
exit
elsif x6= x4 and y6 = y16 then
count: = count - 1
exit
elsif x6= x4 and y8 = y16 then
count: = count - 1
exit
elsif x6= x4 and y6 = y17 then
count: = count - 1
exit
elsif x6= x4 and y8 = y17 then
count: = count - 1
exit
end if
end loop
put "Play Again? y/n"
put "Lives:", count
get answer
if answer = "n" then
exit
end if
cls
if count = 0 then
cls
delay(500)
locate (10, 40)
put "OH NO!!!"
delay(1000)
cls
locate (10, 40)
put "GAME OVER!!!!!!!!!!!!!!!!!!!"
delay(1000)
exit
end if
end loop
procedure ending
cls
delay(1000)
locate (10, 33)
put "THANK YOU FOR PLAYING FROGGER!"
delay(1500)
cls
locate(10, 33)
put "SEE YOU NEXT TIME!!"
delay(1000)
drawfillarc (300, 1, 30, 30, 360, 180, brightgreen)
drawfilloval (290, 20, 5, 5, white)
drawfilloval (290, 20, 3, 3, black)
drawfilloval (310, 20, 5, 5, white)
drawfilloval (310, 20, 3, 3, black)
delay(2000)
cls
locate (10, 35)
put "THE END"
drawfillarc (300, 1, 30, 30, 360, 180, brightgreen)
drawfilloval (290, 20, 5, 5, white)
drawfilloval (290, 20, 3, 3, black)
drawfilloval (310, 20, 5, 5, white)
drawfilloval (310, 20, 3, 3, black)
end ending
var end1: int: = GUI.CreateButtonFull (300, 210, 0, "END GAME", ending, 0, '^D', true)
loop
exit when GUI.ProcessEvent
end loop |
|