I decided to add some new stuff to my 2 old, simple games. check them out if you want.
The Bouncing Game
Turing: |
var num : int
var font1 : int
var font2 : int
var keys : array char of boolean %my variables and constants
var x, y, y2 := 50
var x2 := 200
var Y2,X2 := 200
var X, Y := 100
var y_velocity := 0
var y_velocity2 := 0
const gravity := 2
var bounce := 0
var try : string
var ch : char
font1 := Font.New("Gungsuh:20:bold")
font2 := Font.New("Comic Sans MS:20")
setscreen ("graphics:300;500, offscreenonly")
proc intro
cls
put skip
Font.Draw("The Bouncing Game!", 27, 475, font2, black)
put skip
put "How long can you keep the balls in"
put "the air?"
put "Press -> and <- to move the platform!"
put "Good luck!"
put "Press any key to start!"
Draw.FillBox (x,y,x2,y2- 20, black) %Objects and end loop
Draw.FillOval(X, Y, 15, 15, blue )
Draw.FillOval(X2,Y2, 15, 15, red )
View.Update
Input.Pause
end intro
procedure game
loop
Input.KeyDown (keys ) %Line movements
if keys (KEY_RIGHT_ARROW) and x2 < maxx then
x2 + = 25
x + = 25
end if
if keys (KEY_LEFT_ARROW) and x > 0 then
x2 - = 25
x - = 25
end if
y_velocity - = gravity %Ball gravity effect
Y + = y_velocity
y_velocity2 - = gravity
Y2 + = y_velocity2
if Y <= 0 then
x := 50
x2 := 200
y := 50
y2 := 50
X := 100
y_velocity := 0
y_velocity2 := 0
Y := 100
X2 := 200
Y2 := 200
Font.Draw("Game Over!", 70, 470, font1, black)
locate(4, 10)
put "You bounced ",bounce, " times!"
locate(5, 9)
put "Press any key to retry!"
Draw.FillBox (x,y,x2,y2- 20, black) %Objects and end loop
Draw.FillOval(X, Y, 15, 15, blue )
Draw.FillOval(X2,Y2, 15, 15, red )
bounce := 0
View.Update
Input.Pause
game
end if
if Y2 <= 0 then
x := 50
x2 := 200
y := 50
y2 := 50
X := 100
y_velocity := 0
y_velocity2 := 0
Y := 100
X2 := 200
Y2 := 200
Font.Draw("Game Over!", 70, 470, font1, black)
locate(4, 10)
put "You bounced ",bounce, " times!"
locate (5, 9)
put "Press any key to retry!"
Draw.FillBox (x,y,x2,y2- 20, black) %Objects and end loop
Draw.FillOval(X, Y, 15, 15, blue )
Draw.FillOval(X2,Y2, 15, 15, red )
bounce := 0
View.Update
Input.Pause
game
end if
if Math.DistancePointLine (X,Y,x,y,x2,y2 ) < 20 then %Ball bounce
y_velocity := 35
X := Rand.Int (1, 300)
bounce := bounce + 1
end if
if Math.DistancePointLine (X2,Y2,x,y,x2,y2 ) < 20 then %Ball bounce
y_velocity2 := 40
X2 := Rand.Int (1, 300)
bounce := bounce + 1
end if
Draw.FillBox (x,y,x2,y2- 20, black) %Objects and end loop
Draw.FillOval(X, Y, 15, 15, brightblue )
Draw.FillOval(X2,Y2, 15, 15, brightred )
Time.DelaySinceLast (20)
View.Update
cls
end loop
end game
intro
game
|
Rock Paper Scissors Lizard Spock
Turing: |
import GUI
var rock,paper,scissors,lizard,spock : boolean := false
var computer1 : int
var score,score2,score3 : int
score := 0
score2 := 0
score3 := 0
proc ROCK
rock := true
cls
GUI.Refresh
computer1 := Rand.Int (1, 5)
if computer1 = 1 then
put "Tie!"
score2 + = 1
elsif computer1 = 2 then
put "You lose! Paper covers rock!"
score3 + = 1
elsif computer1 = 3 then
put "You win! Rock beats Scissors!"
score := score + 1
elsif computer1 = 4 then
put "You win! Rock crushes lizard!"
score := score + 1
elsif computer1 = 5 then
put "You lose! Spock vaporizes rock!"
score3 + = 1
end if
end ROCK
proc PAPER
paper := true
cls
GUI.Refresh
computer1 := Rand.Int (1, 5)
if computer1 = 1 then
put "You win!! Paper covers rock!"
score := score + 1
elsif computer1 = 2 then
put "Tie!"
score2 + = 1
elsif computer1 = 3 then
put "You lose! Scissor cuts paper!"
score3 + = 1
elsif computer1 = 4 then
put "You lose! Lizard eats paper!"
score3 + = 1
elsif computer1 = 5 then
put "You win! Paper disproves spock!"
score := score + 1
end if
end PAPER
proc SCISSOR
scissors := true
cls
GUI.Refresh
computer1 := Rand.Int (1, 5)
if computer1 = 1 then
put "You lose! Rock beats Scissors!"
score3 + = 1
elsif computer1 = 2 then
put "You win! Scissors cuts paper!"
score := score + 1
elsif computer1 = 3 then
put "Tie!"
score2 + = 1
elsif computer1 = 4 then
put "You win! Scissors dicapitate lizard!"
score := score + 1
elsif computer1 = 5 then
put "You lose! Spock smashes scissors!"
score3 + = 1
end if
end SCISSOR
proc SPOCK
spock := true
cls
GUI.Refresh
computer1 := Rand.Int (1, 5)
if computer1 = 1 then
put "You win! Spock vapourises rock!"
score := score + 1
elsif computer1 = 2 then
put "You lose! Paper disproves spock!"
score3 + = 1
elsif computer1 = 3 then
put "You win! Spock smashes scissors"
score := score + 1
elsif computer1 = 4 then
put "You lose! Lizard poisons spock!!"
score3 + = 1
elsif computer1 = 5 then
put "Tie!!"
score2 + = 1
end if
end SPOCK
proc LIZARD
lizard := true
cls
GUI.Refresh
computer1 := Rand.Int (1, 5)
if computer1 = 1 then
put "You lose! Rock crushes lizard!"
score3 + = 1
elsif computer1 = 2 then
put "You win! Lizard eats paper!"
score := score + 1
elsif computer1 = 3 then
put "You lose! Scissors decapitate lizard!"
score3 + = 1
elsif computer1 = 4 then
put "You win! Lizard poisons spock!"
score := score + 1
elsif computer1 = 5 then
put "Tie!!"
score2 + = 1
end if
end LIZARD
procedure SCORE
cls
GUI.Refresh
put "You won ",score, " time[s]!"
put""
put "You got ",score2, " tie[s]!"
put ""
put "You lost ",score3, " time[s]!"
end SCORE
procedure QUIT
GUI.Quit
quit
end QUIT
View.Set ("graphics:375;250,nobuttonbar")
var Rock : int := GUI.CreateButtonFull (55, 100, 0, "Rock",
ROCK, 0, '^D', true)
var Paper : int := GUI.CreateButtonFull (150, 50, 0, "Paper",
PAPER, 0, '^D', true)
var Scissor : int := GUI.CreateButtonFull (250, 50, 0, "Scissors",
SCISSOR, 0, '^D', true)
var Lizard : int := GUI.CreateButtonFull (50, 50, 0, "Lizard",
LIZARD, 0, '^D', true)
var Spock : int := GUI.CreateButtonFull (255, 100, 0, "Spock",
SPOCK, 0, '^D', true)
var Score : int := GUI.CreateButtonFull (52, 10, 0, "Score",
SCORE, 0, '^D', true)
var quitBtn : int := GUI.CreateButtonFull (152, 10, 0, "Quit",
QUIT, 0, '^D', true)
loop
exit when GUI.ProcessEvent
end loop
|
|