var ch : array char of boolean
var x : int := 12
var y : int := 15
var col : int := 8
var score : int := 0
var x2 : int := Rand.Int (1, maxx)
var y2 : int := Rand.Int (1, maxy)
var x3 : int := Rand.Int (1, maxx)
var y3 : int := Rand.Int (1, maxy)
var x4 : int := Rand.Int (1, maxx)
var y4 : int := Rand.Int (1, maxy)
var x5 : int := Rand.Int (1, maxx)
var y5 : int := Rand.Int (1, maxy)
var x6 : int := Rand.Int (1, maxx)
var y6 : int := Rand.Int (1, maxy)
var timedelay : int := 0
colourback (black)
cls
colour (white)
var key : string (1)
put " Welcome To The Smiley Face Ball Catching Game"
put ""
put " How long would you like the delay to be? (0..50)"
get timedelay
cls
put ""
put " Welcome To The Smiley Face Ball Catching Game"
put " Controls : "
put " Arrow Keys = Movement"
put " O = Color Change"
setscreen ("offscreenonly")
getch (key)
loop
%Maze Walls%
Draw.ThickLine (x - 5, y - 5, x + 5, y - 5, 3, black)
Draw.ThickLine (0, 2, 530, 2, 5, brightred)
Draw.ThickLine (0, 30, 500, 30, 5, brightred)
Draw.ThickLine (530, 2, 530, 50, 5, brightred)
Draw.ThickLine (500, 30, 500, 70, 5, brightred)
Input.KeyDown (ch)
%Collision Detection%
if ch (KEY_RIGHT_ARROW) and y - 2 > 0 and View.WhatDotColour (x + 11, y)= brightred then
cls
exit
end if
if ch (KEY_LEFT_ARROW) and y - 2 > 0 and View.WhatDotColour (x - 11, y) = brightred then
cls
exit
end if
if ch (KEY_DOWN_ARROW) and y - 2 > 0 and View.WhatDotColour (x, y - 11) = brightred then
cls
exit
end if
if ch (KEY_UP_ARROW) and y - 2 > 0 and View.WhatDotColour (x, y + 11) = brightred then
cls
exit
end if
%Movement%
if ch (KEY_UP_ARROW) and y - 2 > 0 and View.WhatDotColour (x, y + 10) = black then
y := y + 1
end if
if ch (KEY_DOWN_ARROW) and y - 2 > 0 and View.WhatDotColour (x, y - 11) = black then
y := y - 1
end if
if ch (KEY_LEFT_ARROW) and x - 2 > 0 and View.WhatDotColour (x - 11, y) = black then
x := x - 1
end if
if ch (KEY_RIGHT_ARROW) and x + 2 < maxx and View.WhatDotColour (x + 11, y) = black then
x := x + 1
end if
if ch ('o') then
col := Rand.Int (1, 200)
end if
%Draw Character%
drawfilloval (x, y, 10, 10, col)
drawfilloval (x - 4, y + 3, 4, 4, black)
drawfilloval (x + 4, y + 3, 4, 4, black)
View.Update
delay (timedelay)
cls
%Score%
put "Score : ", score
end loop
|