Jump to content

? servers

? players online

Turing- My 1st game

Recommended Posts


  • Content Count:  11728
  • Joined:  09/17/08
  • Status:  Offline

% ICS 3C1 CANNONBALL GAME
% GothicE



% Var
var vel : int
var an : int
var input : string (1)

var x, y : int
var x1, y1 : int
var count : int
var count2 : int
var gravity : int

var yes : string
var no : string




colorback (255)
drawfill (0, 0, 255, 255)
color (12)
var font1 : int
font1 := Font.New ("GothicE:20")
assert font1 > 0
Font.Draw ("CannonBall Game", 200, 350, font1, 12)
Font.Free (font1)
locate (5, 21)




put "           Instructions"
put ""
put "1). Enter the velocity (Speed) for your Cannon ball, betweeb 1-30 m/s"
put ""
put "2). Enter the angle at which you want to launch your cannonball,"
put "between 1 and 30 degrees"
put ""
put "3). Watch where your cannonball lands so that you can adjust for your next shot"
put ""
put "4). When you finally hit the target, your score will be displayed"
put "and you can play again with the target moved to a new, random location."
put ""
put ""
put ""
put "                                     ENJOY!"
put ""
put "                           Press Any Key To Continue" ..
getch (input)

cls
loop
   % Ground
   drawfillbox (0, 0, 639, 30, 113)
   % Sky
   drawfillbox (0, 30, 639, 399, 177)
   %Moon
   drawfilloval (600, 380, 60, 60, 30)
   drawfilloval (630, 360, 10, 10, 8)
   drawfilloval (610, 380, 10, 10, 8)
   drawfilloval (580, 350, 10, 10, 8)
   drawfilloval (560, 380, 10, 10, 8)
   drawfilloval (610, 340, 10, 10, 8)
   % Stars
   drawfillstar (80, 340, 100, 320, 25)
   drawfillstar (30, 400, 100, 320, 25)
   drawfillstar (200, 340, 250, 320, 25)
   drawfillstar (240, 340, 280, 390, 25)
   drawfillstar (160, 360, 190, 390, 25)
   %Text
   colorback (177)
   %Ball
   drawfilloval (40, 40, 10, 10, 12)
   %Pad
   drawline (550, 30, 620, 30, 14)
   loop

       % Enter Velocity
       locate (1, 1)
       put "Enter Velocity between 1 and 30 " ..
       get vel

       exit when vel >= 1 and vel         locate (2, 1)
       % Re-Enter Velocity
       put " Re-enter a number between 1 and 30" ..
       delay (2000)
       locate (2, 1)
       put "                                                 " ..
       locate (1, 33)
       put "                                                 " ..
   end loop





   loop
       % Enter a Angle
       locate (2, 1)
       put "Enter Angle between 1 and 90 " ..
       get an

       exit when an >= 1 and an         locate (2, 1)

       % Re-Enter a Angle
       put "Re-enter a number between 1 and 90 " ..
       delay (2000)
       locate (2, 1)
       put "                                          " ..

   end loop



   x := 40
   y := 40
   x1 := 40
   y1 := 40
   count := 0
   count2 := 0
   gravity := 1

   % Animate loop
   loop
       drawfilloval (x, y, 10, 10, 12)
       exit when y         delay (30)
       drawfilloval (x, y, 10, 10, 177)



       x := round (x1 + vel * count * cosd (an))
       y := round (y1 + vel * count * sind (an) - 0.5 * gravity * count ** 2)

       count := count + 1



   end loop


   if x >= 550 and x 
       % Bomb
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       delay (20)
       drawfilloval (580, 35, 10, 10, 44)
       delay (20)
       drawfilloval (580, 35, 10, 10, 12)
       delay (20)
       drawfilloval (580, 35, 10, 10, 43)
       delay (20)
       drawfilloval (580, 35, 10, 10, 40)
       % Ball hit target
       put "You ball hit the target" ..

       % Play again?
       locate (2, 1)
       put "Would you like to play again y/n?" ..
       getch (input)
       put "                                                 " ..
       locate (2, 1)
       put "                                                 " ..
   else
       locate (3, 1)
       % Try again
       put "Try Again" ..

       put "" ..
       locate (4, 1)
       % Would you like to play again
       put "Would you like to play again y/n?" ..
       getch (input)
       put "" ..


       cls
       locate (2, 1)
       put "                                                 " ..
       locate (1, 33)
       put "                                                 " ..
   end if

end loop


 

 

Download turing and copy and paste.

http://compsci.ca/blog/download-turing-411/

Link to comment

Reply to Thread

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...