Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 my first turing program- frogger! plz critique and suggest improvement
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
renzor




PostPosted: Tue Jun 19, 2007 7:57 pm   Post subject: my first turing program- frogger! plz critique and suggest improvement

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
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue Jun 19, 2007 9:15 pm   Post subject: RE:my first turing program- frogger! plz critique and suggest improvement

Arrays.
[code] or [syntax] tags
Decadence666




PostPosted: Wed Jun 20, 2007 11:09 am   Post subject: RE:my first turing program- frogger! plz critique and suggest improvement

See how its really flickery? You can fix that problem with View.Update and offscreenonly, this uses a double buffer.

If you look in the Tutorial section, there will probably be a tutorial about 'offscreenonly' and 'View.Update' somewhere..
tenniscrazy




PostPosted: Wed Jun 20, 2007 1:43 pm   Post subject: RE:my first turing program- frogger! plz critique and suggest improvement

you should make the program exit at the end after you say you dont want to play again. cause right now you have to close the window or end the program manually
lordroba




PostPosted: Wed Jun 20, 2007 2:02 pm   Post subject: RE:my first turing program- frogger! plz critique and suggest improvement

I kinda don't see the point of using the GUI function since there weren't any buttons/scroll bars. (At least I didn't see any...)
carGUY17




PostPosted: Mon Jun 25, 2007 1:11 am   Post subject: Re: my first turing program- frogger! plz critique and suggest improvement

its an alright start but i think u should make actual cars and a bit harder and somtimes the circles go right threw the frog nice job just need improvement
wtd




PostPosted: Mon Jun 25, 2007 2:34 pm   Post subject: Re: RE:my first turing program- frogger! plz critique and suggest improvement

Clayton @ Wed Jun 20, 2007 10:15 am wrote:
Arrays.
[code] or [syntax] tags


Yes, yes, yes. Add loops and Clayton would be absolutely correct.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: