View.Set ("position:center;center,offscreenonly, nocursor, nobuttonbar,title: Avoid the Circles!!")
% variables
var circle_
1_x, circle_
1_y, circle_
1_radius
: int
var circle_
2_x, circle_
2_y, circle_
2_radius
: int
var circle3x, circle3y, circle3radius
: int
var circle4x, circle4y, circle4radius
: int
var circle5x, circle5y, circle5radius
: int
var circle6x, circle6y, circle6radius
: int
var circle7x, circle7y, circle7radius
: int
var circle8y, circle8x, circle8radius
: int
var circle9y, circle9x, circle9radius
: int
var x
: int % your circle
var y
: int % your circle
var circle_radius
: int % your circle
var chars
: array char of boolean
var xdir
: int := 2 % all stuff for boundaries
var ydir
: int := 2 % " "
var xdir2
: int := 3
var ydir2
: int := 3
var xdir3
: int := 5
var ydir3
: int := 5
var xdir4
: int := 4
var ydir4
: int := 4
var xdir5
: int := 10
var ydir5
: int := 10
var xdir6
: int := 2
var xdir7
: int := 2
var ydir8
: int := 2
var ydir9
: int := 2
var distance_between_centres
: real % stuff for collision
var distance_betweeen_centres
: real
var distance_betweeeen_centres
: real
var distance_betweeeeen_centres
: real
var distance_betweeeeeen_centres
: real
var distance_between_centres1
: real
var distance_between_centres2
: real
var distance_between_centres3
: real
var distance_between_centres4
: real
var counter
: int % To end levels at certain times
var counter2
: int
var counter3
: int
var counter4
: int
var counter5
: int
var font1
: int
var gameover
: int
var youwin
: int
var key
: string (1)
var level
: int
var choice
: string
var deadoralive
: string := "alive"
var colourcount
: int := 32
%%%%%%%%%%%%%%%%%%%%%%%Mouse%%%%%%%%%%%%%%%%
var mx, my, mb
: int := 0
%values of circles
circle_
1_x
:= 50
circle_
1_y
:= 200
circle_
1_radius
:= 50
circle_
2_x
:= 200
circle_
2_y
:= 200
circle_
2_radius
:= 70
circle3x
:= 450
circle3y
:= 85
circle3radius
:= 22
circle4x
:= 500
circle4y
:= 310
circle4radius
:= 45
circle5x
:= 70
circle5y
:= 100
circle5radius
:= 3
circle6x
:= 29
circle6y
:= 25
circle6radius
:= 30
circle7x
:= 300
circle7y
:= 370
circle7radius
:= 30
circle8x
:= 20
circle8y
:= 25
circle8radius
:= 30
circle9x
:= 612
circle9y
:= 380
circle9radius
:= 30
x
:= 150
y
:= 91
circle_radius
:= 23
counter3
:= 0
counter2
:= 0
counter
:= 0
counter4
:= 0
counter5
:= 0
%Fonts
font1
:= Font.New ("Vineta BT:21:underline")
assert font1 >
0
gameover
:= Font.New ("Wide Latin:30:bold")
assert gameover >
0
youwin
:= Font.New ("Wide Latin:19:bold")
assert youwin >
0
level
:= Font.New ("Castellar:11")
assert level >
0
/*****TITLE PAGE*******/
loop
cls
drawfill
(maxx,
maxy,
10,
14)
Font.Draw ("Welcome to Circular Danger", 9,
300, font1,
255)
locatexy (1,
100)
colorback (103)
put " Press any key to continue" : 1
getch (key
)
View.Update
cls
%%%%%%%%%%Choice Screen%%%%%%%%%%%%%%%
View.Update
drawfill
(maxx,
maxy,
42,
42)
colorback (94)
locatexy (1,
300)
put "1. How to Play...?"
locatexy (1,
250)
put "2. Start the Game!!! (Using keys)"
locatexy (1,
200)
put "3. Start the Game!!! (Using mouse)"
locatexy (1,
150)
put "Please choose an option or enter a cheat."
View.Update
get choice
cls
if choice
= "1" then
%%%%%%%%%%%%%How to Play screen%%%%%%%%%%
drawfill
(maxx,
maxy,
88,
88)
colourback (118)
locatexy (1,
350)
put " OBJECTIVE"
colourback (68)
locatexy (1,
290)
put "The objective of circular danger is quite simple, AVOID the CIRCLES."
colourback (118)
locatexy (1,
230)
put " CONTROLS"
colourback (68)
locatexy (1,
170)
put "You control the circle that flashes different colours using the arrow keys."
put "Up arrow moves you up, Down arrow moves you down, Left arrow moves you left and the Right arrow moves you right."
colourback (61)
locatexy (1,
80)
put " Press any key to start the game"
View.Update
getch (key
)
exit
elsif choice
= "2" then
exit
elsif choice
= "smallcircle" then
circle_radius
:= 5
locatexy (1,
400)
put "Cheat smallcircle activated."
View.Update
getch (key
)
exit
elsif choice
= "bigdanger" then
circle_
1_radius
:= 65
circle_
2_radius
:= 80
circle3radius
:= 30
circle4radius
:= 46
circle5radius
:= 7
circle_radius
:= 19
locatexy (1,
400)
put "Cheat bigdanger activated."
put "Good luck, you will need it!"
View.Update
getch (key
)
exit
elsif choice
= "speedy" then
locatexy (1,
400)
put "Cheat speedy activated."
put "Fasten your seatbelt."
View.Update
getch (key
)
exit
elsif choice
= "3" then
exit
end if
end loop
%%%%%%%%%%%%%Level 1 loop%%%%%%%%%%%%%
loop
counter
:= counter +
1
put counter
if colourcount >
55 then
colourcount
:= 32
end if
colourcount
:= colourcount +
1
exit when counter >
700
%for i : 1 .. 45
%draw our circles
cls
drawfill
(maxx,
maxy,
101,
101)
Font.Draw ("Level 1", 285,
380, level,
255)
drawfilloval (circle_
1_x, circle_
1_y, circle_
1_radius, circle_
1_radius,
36) %big one you're avoiding
drawfilloval (circle_
2_x, circle_
2_y, circle_
2_radius, circle_
2_radius,
23) %big one you're avoiding
delay (8)
View.Update
% Move your circle
Input.KeyDown (chars
)
if choice
= "1" or choice
= "2" then
drawfilloval (x, y, circle_radius, circle_radius, colourcount
) %one that you move
if choice
= "smallcircle" then
if chars
(KEY_UP_ARROW) and y <
385 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
625 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
14 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
12 then
y
:= y -
4
end if
elsif choice
= "speedy" then
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
8
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
8
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
8
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
8
end if
else
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
23 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
4
end if
end if
elsif choice
= "3" then
mousewhere (mx, my, mb
)
if my >
375 then
my
:= 375
elsif my <
25 then
my
:= 25
end if
if mx >
615 then
mx
:= 615
elsif mx <
25 then
mx
:= 25
end if
drawfilloval (mx, my, circle_radius, circle_radius, colourcount
) %one that you move
View.Update
delay (8)
cls
end if
%Move the other circles
if choice
= "bigdanger" then
if circle_
1_y >
330 then
ydir
:= -
2
elsif circle_
1_y <
68 then
ydir
:= 2
end if
if circle_
1_x >
571 then
xdir
:= -
2
elsif circle_
1_x <
73 then
xdir
:= 2
end if
if circle_
2_y >
316 then
ydir2
:= -
3
elsif circle_
2_y <
80 then
ydir2
:= 3
end if
if circle_
2_x >
555 then
xdir2
:= -
3
elsif circle_
2_x <
82 then
xdir2
:= 3
end if
else
if circle_
1_y >
345 then
ydir
:= -
2
elsif circle_
1_y <
49 then
ydir
:= 2
end if
if circle_
1_x >
578 then
xdir
:= -
2
elsif circle_
1_x <
48 then
xdir
:= 2
end if
if circle_
2_y >
325 then
ydir2
:= -
3
elsif circle_
2_y <
67 then
ydir2
:= 3
end if
if circle_
2_x >
570 then
xdir2
:= -
3
elsif circle_
2_x <
70 then
xdir2
:= 3
end if
end if
circle_
1_x
:= circle_
1_x + xdir
circle_
1_y
:= circle_
1_y + ydir
circle_
2_x
:= circle_
2_x + xdir2
circle_
2_y
:= circle_
2_y + ydir2
%calculate the distance between the centres of the circles
if choice
= "3" then
distance_between_centres
:= sqrt ((mx - circle_
1_x
) **
2 +
(my - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((mx - circle_
2_x
) **
2 +
(my - circle_
2_y
) **
2)
else
distance_between_centres
:= sqrt ((x - circle_
1_x
) **
2 +
(y - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((x - circle_
2_x
) **
2 +
(y - circle_
2_y
) **
2)
end if
% collision detection
if distance_between_centres <= circle_
1_radius + circle_radius
or distance_betweeen_centres <= circle_
2_radius + circle_radius
then
Font.Draw ("GAME OVER!!", 50,
200, gameover,
255)
exit
end if
end loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%LEVEL 2!!!!!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
if deadoralive
= "alive" then
counter2
:= counter2 +
1
put counter2
exit when counter2 >
600
if colourcount >
55 then
colourcount
:= 32
end if
colourcount
:= colourcount +
1
cls
drawfill
(maxx,
maxy,
84,
84)
Font.Draw ("Level 2", 285,
380, level,
255)
drawfilloval (circle_
1_x, circle_
1_y, circle_
1_radius, circle_
1_radius,
36) %big one you're avoiding
drawfilloval (circle_
2_x, circle_
2_y, circle_
2_radius, circle_
2_radius,
23) %very big one you're avoiding
drawfilloval (circle3x, circle3y, circle3radius, circle3radius,
45) %small one you're avoiding
delay (10)
% Move your circle
Input.KeyDown (chars
)
if choice
= "1" or choice
= "2" then
drawfilloval (x, y, circle_radius, circle_radius, colourcount
) %one that you move
if choice
= "smallcircle" then
if chars
(KEY_UP_ARROW) and y <
385 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
625 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
14 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
12 then
y
:= y -
4
end if
elsif choice
= "speedy" then
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
8
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
8
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
8
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
8
end if
else
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
4
end if
end if
elsif choice
= "3" then
mousewhere (mx, my, mb
)
if my >
375 then
my
:= 375
elsif my <
20 then
my
:= 25
end if
if mx >
615 then
mx
:= 615
elsif mx <
20 then
mx
:= 25
end if
drawfilloval (mx, my, circle_radius, circle_radius, colourcount
) %one that you move
end if
View.Update
delay (7)
cls
%Move the other circles
if choice
= "bigdanger" then
if circle_
1_y >
330 then
ydir
:= -
2
elsif circle_
1_y <
68 then
ydir
:= 2
end if
if circle_
1_x >
571 then
xdir
:= -
2
elsif circle_
1_x <
73 then
xdir
:= 2
end if
if circle_
2_y >
316 then
ydir2
:= -
3
elsif circle_
2_y <
80 then
ydir2
:= 3
end if
if circle_
2_x >
555 then
xdir2
:= -
3
elsif circle_
2_x <
82 then
xdir2
:= 3
end if
if circle3y >
365 then
ydir3
:= -
5
elsif circle3y <
32 then
ydir3
:= 5
end if
if circle3x >
598 then
xdir3
:= -
5
elsif circle3x <
34 then
xdir3
:= 5
end if
else
if circle_
1_y >
349 then
ydir
:= -
2
elsif circle_
1_y <
49 then
ydir
:= 2
end if
if circle_
1_x >
578 then
xdir
:= -
2
elsif circle_
1_x <
48 then
xdir
:= 2
end if
if circle_
2_y >
329 then
ydir2
:= -
3
elsif circle_
2_y <
67 then
ydir2
:= 3
end if
if circle_
2_x >
570 then
xdir2
:= -
3
elsif circle_
2_x <
70 then
xdir2
:= 3
end if
if circle3y >
366 then
ydir3
:= -
5
elsif circle3y <
27 then
ydir3
:= 5
end if
if circle3x >
602 then
xdir3
:= -
5
elsif circle3x <
28 then
xdir3
:= 5
end if
end if
circle_
1_x
:= circle_
1_x + xdir
circle_
1_y
:= circle_
1_y + ydir
circle_
2_x
:= circle_
2_x + xdir2
circle_
2_y
:= circle_
2_y + ydir2
circle3y
:= circle3y + ydir3
circle3x
:= circle3x + xdir3
%calculate the distance between the centres of the circles
if choice
= "3" then
distance_between_centres
:= sqrt ((mx - circle_
1_x
) **
2 +
(my - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((mx - circle_
2_x
) **
2 +
(my - circle_
2_y
) **
2)
distance_betweeeen_centres
:= sqrt ((mx - circle3x
) **
2 +
(my - circle3y
) **
2)
else
distance_between_centres
:= sqrt ((x - circle_
1_x
) **
2 +
(y - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((x - circle_
2_x
) **
2 +
(y - circle_
2_y
) **
2)
distance_betweeeen_centres
:= sqrt ((x - circle3x
) **
2 +
(y - circle3y
) **
2)
end if
% collision detection
if distance_between_centres <= circle_
1_radius + circle_radius
or distance_betweeen_centres <= circle_
2_radius + circle_radius
or distance_betweeeen_centres <= circle3radius + circle_radius
then
deadoralive
:= "dead"
Font.Draw ("GAME OVER!!", 50,
200, gameover,
255)
exit
end if
elsif deadoralive
= "dead" then
exit
end if
end loop
%****************************************************LEVEL 3!!!!!!*****************************************************%
loop
if deadoralive
= "alive" then
if colourcount >
55 then
colourcount
:= 32
end if
colourcount
:= colourcount +
1
cls
drawfill
(maxx,
maxy,
3,
3)
Font.Draw ("Level 3", 285,
380, level,
255)
drawfilloval (circle_
1_x, circle_
1_y, circle_
1_radius, circle_
1_radius,
36) %big one you're avoiding
drawfilloval (circle_
2_x, circle_
2_y, circle_
2_radius, circle_
2_radius,
23) %very big one you're avoiding
drawfilloval (circle3x, circle3y, circle3radius, circle3radius,
45) %small one you're avoiding
drawfilloval (circle4x, circle4y, circle4radius, circle4radius,
76) %medium one you're avoiding
delay (10)
% Move your circle
Input.KeyDown (chars
)
if choice
= "1" or choice
= "2" then
drawfilloval (x, y, circle_radius, circle_radius, colourcount
) %one that you move
if choice
= "smallcircle" then
if chars
(KEY_UP_ARROW) and y <
385 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
625 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
14 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
12 then
y
:= y -
4
end if
elsif choice
= "speedy" then
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
8
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
8
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
8
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
8
end if
else
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
4
end if
end if
elsif choice
= "3" then
mousewhere (mx, my, mb
)
if my >
375 then
my
:= 375
elsif my <
25 then
my
:= 25
end if
if mx >
615 then
mx
:= 615
elsif mx <
25 then
mx
:= 25
end if
drawfilloval (mx, my, circle_radius, circle_radius, colourcount
) %one that you move
end if
View.Update
delay (7)
cls
%Move the other circles
if choice
= "bigdanger" then
if circle_
1_y >
330 then
ydir
:= -
2
elsif circle_
1_y <
68 then
ydir
:= 2
end if
if circle_
1_x >
571 then
xdir
:= -
2
elsif circle_
1_x <
73 then
xdir
:= 2
end if
if circle_
2_y >
316 then
ydir2
:= -
3
elsif circle_
2_y <
80 then
ydir2
:= 3
end if
if circle_
2_x >
555 then
xdir2
:= -
3
elsif circle_
2_x <
82 then
xdir2
:= 3
end if
if circle3y >
349 then
ydir3
:= -
5
elsif circle3y <
38 then
ydir3
:= 5
end if
if circle3x >
580 then
xdir3
:= -
5
elsif circle3x <
41 then
xdir3
:= 5
end if
if circle4y >
334 then
ydir4
:= -
4
elsif circle4y <
65 then
ydir4
:= 4
end if
if circle4x >
569 then
xdir4
:= -
4
elsif circle4x <
54 then
xdir4
:= 4
end if
else
if circle_
1_y >
349 then
ydir
:= -
2
elsif circle_
1_y <
49 then
ydir
:= 2
end if
if circle_
1_x >
578 then
xdir
:= -
2
elsif circle_
1_x <
48 then
xdir
:= 2
end if
if circle_
2_y >
329 then
ydir2
:= -
3
elsif circle_
2_y <
67 then
ydir2
:= 3
end if
if circle_
2_x >
570 then
xdir2
:= -
3
elsif circle_
2_x <
95 then
xdir2
:= 3
end if
if circle3y >
366 then
ydir3
:= -
5
elsif circle3y <
28 then
ydir3
:= 5
end if
if circle3x >
605 then
xdir3
:= -
5
elsif circle3x <
30 then
xdir3
:= 5
end if
if circle4y >
354 then
ydir4
:= -
4
elsif circle4y <
50 then
ydir4
:= 4
end if
if circle4x >
588 then
xdir4
:= -
4
elsif circle4x <
42 then
xdir4
:= 4
end if
end if
circle_
1_x
:= circle_
1_x + xdir
circle_
1_y
:= circle_
1_y + ydir
circle_
2_x
:= circle_
2_x + xdir2
circle_
2_y
:= circle_
2_y + ydir2
circle3y
:= circle3y + ydir3
circle3x
:= circle3x + xdir3
circle4y
:= circle4y + ydir4
circle4x
:= circle4x + xdir4
%calculate the distance between the centres of the circles
if choice
= "3" then
distance_between_centres
:= sqrt ((mx - circle_
1_x
) **
2 +
(my - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((mx - circle_
2_x
) **
2 +
(my - circle_
2_y
) **
2)
distance_betweeeen_centres
:= sqrt ((mx - circle3x
) **
2 +
(my - circle3y
) **
2)
distance_betweeeeen_centres
:= sqrt ((mx - circle4x
) **
2 +
(my - circle4y
) **
2)
else
distance_between_centres
:= sqrt ((x - circle_
1_x
) **
2 +
(y - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((x - circle_
2_x
) **
2 +
(y - circle_
2_y
) **
2)
distance_betweeeen_centres
:= sqrt ((x - circle3x
) **
2 +
(y - circle3y
) **
2)
distance_betweeeeen_centres
:= sqrt ((x - circle4x
) **
2 +
(y - circle4y
) **
2)
end if
% collision detection
if distance_between_centres <= circle_
1_radius + circle_radius
or distance_betweeen_centres <= circle_
2_radius + circle_radius
or distance_betweeeen_centres <= circle3radius + circle_radius
or distance_betweeeeen_centres <= circle4radius + circle_radius
then
deadoralive
:= "dead"
Font.Draw ("GAME OVER!!", 50,
200, gameover,
255)
exit
end if
counter3
:= counter3 +
1
put counter3
exit when counter3 >
500
elsif deadoralive
= "dead" then
exit
end if
end loop
%%%%%%%%%%%&*^#(*#&$%(#@#)@)@)@@%%%%%%%%%LEVEL~4%%%%%%%%%%%%%%%%@$(#!#($@#*&@(@()*$@#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
if deadoralive
= "alive" then
if colourcount >
55 then
colourcount
:= 32
end if
colourcount
:= colourcount +
1
cls
drawfill
(maxx,
maxy,
52,
52)
Font.Draw ("Level 4", 285,
380, level,
255)
drawfilloval (circle_
1_x, circle_
1_y, circle_
1_radius, circle_
1_radius,
36) %big one you're avoiding
drawfilloval (circle6x, circle6y, circle6radius, circle6radius,
255)
drawfilloval (circle7x, circle7y, circle7radius, circle7radius,
255)
drawfilloval (circle4x, circle4y, circle4radius, circle4radius,
86) %medium one you're avoiding
drawfilloval (circle8x, circle8y, circle8radius, circle8radius,
255)
drawfilloval (circle9x, circle9y, circle9radius, circle9radius,
255)
delay (10)
% Move your circle
Input.KeyDown (chars
)
if choice
= "1" or choice
= "2" then
drawfilloval (x, y, circle_radius, circle_radius, colourcount
) %one that you move
if choice
= "smallcircle" then
if chars
(KEY_UP_ARROW) and y <
385 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
625 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
14 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
12 then
y
:= y -
4
end if
elsif choice
= "speedy" then
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
8
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
8
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
8
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
8
end if
else
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
4
end if
end if
elsif choice
= "3" then
mousewhere (mx, my, mb
)
if my >
375 then
my
:= 375
elsif my <
25 then
my
:= 25
end if
if mx >
615 then
mx
:= 615
elsif mx <
25 then
mx
:= 25
end if
drawfilloval (mx, my, circle_radius, circle_radius, colourcount
) %one that you move
end if
View.Update
delay (7)
cls
%Move the other circles
if choice
= "bigdanger" then
if circle_
1_y >
330 then
ydir
:= -
2
elsif circle_
1_y <
68 then
ydir
:= 2
end if
if circle_
1_x >
571 then
xdir
:= -
2
elsif circle_
1_x <
73 then
xdir
:= 2
end if
if circle4y >
334 then
ydir4
:= -
4
elsif circle4y <
65 then
ydir4
:= 4
end if
if circle4x >
569 then
xdir4
:= -
4
elsif circle4x <
54 then
xdir4
:= 4
end if
if circle6x >
630 then
xdir6
:= -
2
elsif circle6x <
30 then
xdir6
:= 2
end if
if circle7x >
630 then
xdir7
:= -
2
elsif circle7x <
30 then
xdir7
:= 2
end if
if circle8y >
382 then
ydir8
:= -
2
elsif circle8y <
22 then
ydir8
:= 2
end if
if circle9y >
382 then
ydir9
:= -
2
elsif circle9y <
22 then
ydir9
:= 2
end if
else
if circle_
1_y >
349 then
ydir
:= -
2
elsif circle_
1_y <
49 then
ydir
:= 2
end if
if circle_
1_x >
578 then
xdir
:= -
2
elsif circle_
1_x <
48 then
xdir
:= 2
end if
if circle4y >
354 then
ydir4
:= -
4
elsif circle4y <
50 then
ydir4
:= 4
end if
if circle4x >
588 then
xdir4
:= -
4
elsif circle4x <
42 then
xdir4
:= 4
end if
if circle6x >
630 then
xdir6
:= -
2
elsif circle6x <
30 then
xdir6
:= 2
end if
if circle7x >
625 then
xdir7
:= -
2
elsif circle7x <
20 then
xdir7
:= 2
end if
if circle8y >
382 then
ydir8
:= -
2
elsif circle8y <
22 then
ydir8
:= 2
end if
if circle9y >
382 then
ydir9
:= -
2
elsif circle9y <
22 then
ydir9
:= 2
end if
end if
circle_
1_x
:= circle_
1_x + xdir
circle_
1_y
:= circle_
1_y + ydir
circle4y
:= circle4y + ydir4
circle4x
:= circle4x + xdir4
circle6x
:= circle6x + xdir6
circle7x
:= circle7x + xdir7
circle9y
:= circle9y + ydir9
circle8y
:= circle8y + ydir8
%calculate the distance between the centres of the circles
if choice
= "3" then
distance_between_centres
:= sqrt ((mx - circle_
1_x
) **
2 +
(my - circle_
1_y
) **
2)
distance_betweeeeen_centres
:= sqrt ((mx - circle4x
) **
2 +
(my - circle4y
) **
2)
distance_between_centres1
:= sqrt ((mx - circle6x
) **
2 +
(my - circle6y
) **
2)
distance_between_centres2
:= sqrt ((mx - circle7x
) **
2 +
(my - circle7y
) **
2)
distance_between_centres3
:= sqrt ((mx - circle8x
) **
2 +
(my - circle8y
) **
2)
distance_between_centres4
:= sqrt ((mx - circle9x
) **
2 +
(my - circle9y
) **
2)
else
distance_between_centres
:= sqrt ((x - circle_
1_x
) **
2 +
(y - circle_
1_y
) **
2)
distance_betweeeeen_centres
:= sqrt ((x - circle4x
) **
2 +
(y - circle4y
) **
2)
distance_between_centres1
:= sqrt ((x - circle6x
) **
2 +
(y - circle6y
) **
2)
distance_between_centres2
:= sqrt ((x - circle7x
) **
2 +
(y - circle7y
) **
2)
distance_between_centres3
:= sqrt ((x - circle8x
) **
2 +
(y - circle8y
) **
2)
distance_between_centres4
:= sqrt ((x - circle9x
) **
2 +
(y - circle9y
) **
2)
end if
% collision detection
if distance_between_centres <= circle_
1_radius + circle_radius
or distance_between_centres1 <= circle6radius + circle_radius
or distance_between_centres2 <= circle7radius + circle_radius
or distance_betweeeeen_centres <= circle4radius + circle_radius
or distance_between_centres4 <= circle9radius + circle_radius
or distance_between_centres3 <= circle8radius + circle_radius
then
Font.Draw ("GAME OVER!!", 50,
200, gameover,
255) %gameover screen
deadoralive
:= "dead"
exit
end if
counter5
:= counter5 +
1
exit when counter5 >
730
elsif deadoralive
= "dead" then
exit
end if
end loop
%%%%%%%%%%%%%%%%%%%%%%%%%%~~~~~~LEVEL 5~~~~~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
if colourcount >
55 then
colourcount
:= 32
end if
colourcount
:= colourcount +
1
if deadoralive
= "alive" then
cls
drawfill
(maxx,
maxy,
12,
12)
Font.Draw ("Level 5", 285,
380, level,
255)
drawfilloval (circle_
1_x, circle_
1_y, circle_
1_radius, circle_
1_radius,
36) %big one you're avoiding
drawfilloval (circle_
2_x, circle_
2_y, circle_
2_radius, circle_
2_radius,
23) %very big one you're avoiding
drawfilloval (circle3x, circle3y, circle3radius, circle3radius,
45) %small one you're avoiding
drawfilloval (circle4x, circle4y, circle4radius, circle4radius,
76) %medium one you're avoiding
drawfilloval (circle5x, circle5y, circle5radius, circle5radius,
57) %very small and fast one you're avoiding
delay (10)
% Move your circle
Input.KeyDown (chars
)
if choice
= "1" or choice
= "2" then
drawfilloval (x, y, circle_radius, circle_radius, colourcount
) %one that you move
if choice
= "smallcircle" then
if chars
(KEY_UP_ARROW) and y <
385 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
625 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
14 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
12 then
y
:= y -
4
end if
elsif choice
= "speedy" then
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
8
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
8
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
8
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
8
end if
else
if chars
(KEY_UP_ARROW) and y <
375 then
y
:= y +
4
end if
if chars
(KEY_RIGHT_ARROW) and x <
613 then
x
:= x +
4
end if
if chars
(KEY_LEFT_ARROW) and x >
27 then
x
:= x -
4
end if
if chars
(KEY_DOWN_ARROW) and y >
25 then
y
:= y -
4
end if
end if
elsif choice
= "3" then
mousewhere (mx, my, mb
)
if my >
375 then
my
:= 375
elsif my <
25 then
my
:= 25
end if
if mx >
615 then
mx
:= 615
elsif mx <
25 then
mx
:= 25
end if
drawfilloval (mx, my, circle_radius, circle_radius, colourcount
) %one that you move
end if
View.Update
delay (7)
cls
%Move the other circles
if choice
= "bigdanger" then
if circle_
1_y >
330 then
ydir
:= -
2
elsif circle_
1_y <
68 then
ydir
:= 2
end if
if circle_
1_x >
571 then
xdir
:= -
2
elsif circle_
1_x <
73 then
xdir
:= 2
end if
if circle_
2_y >
316 then
ydir2
:= -
3
elsif circle_
2_y <
80 then
ydir2
:= 3
end if
if circle_
2_x >
555 then
xdir2
:= -
3
elsif circle_
2_x <
82 then
xdir2
:= 3
end if
if circle3y >
349 then
ydir3
:= -
5
elsif circle3y <
38 then
ydir3
:= 5
end if
if circle3x >
580 then
xdir3
:= -
5
elsif circle3x <
41 then
xdir3
:= 5
end if
if circle4y >
334 then
ydir4
:= -
4
elsif circle4y <
65 then
ydir4
:= 4
end if
if circle4x >
569 then
xdir4
:= -
4
elsif circle4x <
54 then
xdir4
:= 4
end if
if circle5y >
360 then
ydir5
:= -
10
elsif circle5y <
40 then
ydir5
:= 10
end if
if circle5x >
590 then
xdir5
:= -
10
elsif circle5x <
40 then
xdir5
:= 10
end if
else
if circle_
1_y >
349 then
ydir
:= -
2
elsif circle_
1_y <
49 then
ydir
:= 2
end if
if circle_
1_x >
578 then
xdir
:= -
2
elsif circle_
1_x <
48 then
xdir
:= 2
end if
if circle_
2_y >
329 then
ydir2
:= -
3
elsif circle_
2_y <
67 then
ydir2
:= 3
end if
if circle_
2_x >
570 then
xdir2
:= -
3
elsif circle_
2_x <
70 then
xdir2
:= 3
end if
if circle3y >
366 then
ydir3
:= -
5
elsif circle3y <
28 then
ydir3
:= 5
end if
if circle3x >
605 then
xdir3
:= -
5
elsif circle3x <
30 then
xdir3
:= 5
end if
if circle4y >
354 then
ydir4
:= -
4
elsif circle4y <
50 then
ydir4
:= 4
end if
if circle4x >
588 then
xdir4
:= -
4
elsif circle4x <
42 then
xdir4
:= 4
end if
if circle5y >
380 then
ydir5
:= -
10
elsif circle5y <
20 then
ydir5
:= 10
end if
if circle5x >
605 then
xdir5
:= -
10
elsif circle5x <
25 then
xdir5
:= 10
end if
end if
circle_
1_x
:= circle_
1_x + xdir
circle_
1_y
:= circle_
1_y + ydir
circle_
2_x
:= circle_
2_x + xdir2
circle_
2_y
:= circle_
2_y + ydir2
circle3y
:= circle3y + ydir3
circle3x
:= circle3x + xdir3
circle4y
:= circle4y + ydir4
circle4x
:= circle4x + xdir4
circle5y
:= circle5y + ydir5
circle5x
:= circle5x + xdir5
%calculate the distance between the centres of the circles
if choice
= "3" then
distance_between_centres
:= sqrt ((mx - circle_
1_x
) **
2 +
(my - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((mx - circle_
2_x
) **
2 +
(my - circle_
2_y
) **
2)
distance_betweeeen_centres
:= sqrt ((mx - circle3x
) **
2 +
(my - circle3y
) **
2)
distance_betweeeeen_centres
:= sqrt ((mx - circle4x
) **
2 +
(my - circle4y
) **
2)
distance_betweeeeeen_centres
:= sqrt ((mx - circle5x
) **
2 +
(my - circle5y
) **
2)
else
distance_between_centres
:= sqrt ((x - circle_
1_x
) **
2 +
(y - circle_
1_y
) **
2)
distance_betweeen_centres
:= sqrt ((x - circle_
2_x
) **
2 +
(y - circle_
2_y
) **
2)
distance_betweeeen_centres
:= sqrt ((x - circle3x
) **
2 +
(y - circle3y
) **
2)
distance_betweeeeen_centres
:= sqrt ((x - circle4x
) **
2 +
(y - circle4y
) **
2)
distance_betweeeeeen_centres
:= sqrt ((x - circle5x
) **
2 +
(y - circle5y
) **
2)
end if
% collision detection
if distance_between_centres <= circle_
1_radius + circle_radius
or distance_betweeen_centres <= circle_
2_radius + circle_radius
or distance_betweeeen_centres <= circle3radius + circle_radius
or distance_betweeeeen_centres <= circle4radius + circle_radius
or distance_betweeeeeen_centres <= circle5radius + circle_radius
then
Font.Draw ("GAME OVER!!", 50,
200, gameover,
255) %gameover screen
exit
end if
counter4
:= counter4 +
1
exit when counter4 >
400
elsif deadoralive
= "dead" then
exit
end if
end loop
if counter4 >
400 and choice
= "2" then
Font.Draw ("Congratulations, You Won!", 20,
200, youwin,
255) %Win screen
Font.Draw ("Next time try using the cheat bigdanger for a bigger challenge.", 7,
100, level,
255)
elsif counter4 >
400 and choice
= "speedy" then
Font.Draw ("Congratulations, You Won!", 20,
200, youwin,
255) %Win screen
Font.Draw ("Next time try NOT using cheats.", 140,
100, level,
255)
elsif counter4 >
400 and choice
= "bigdanger" then
Font.Draw ("Congratulations, You Won!", 20,
200, youwin,
255) %Win screen
Font.Draw ("You have mastered Circular Danger.", 118,
100, level,
255)
elsif counter4 >
400 and choice
= "smallcircle" then
Font.Draw ("Congratulations, You Won!", 20,
200, youwin,
255) %Win screen
Font.Draw ("Next time try NOT using cheats.", 140,
100, level,
255)
end if
View.Update