setscreen ("graphics:max;max")
%Font variables
var font1, font2, font3 : int
%Oval variables
var ovalx, ovaly : int
%Displacement variable
var displacement : int
%Start variable
var start : int
%Launchx and launchy variables
var launchx, launchy : int
%Force variable
var force : int
%button variables
var buttonnumber, buttonupdown : int
%Rad variables
var radx, rady : int
%Rad =
radx :=8
rady := 23
%Launchx and Launchy =
launchx := maxx div 2
launchy := maxy div 2
%ovals =
ovalx := Rand.Int (1, 615)
ovaly := Rand.Int (150, 390)
%Score numbers
var score : int := 0
%Score string values
var scores : string := ""
var playername : string
%Drawfill
drawfill (10, 10, yellow, black)
%Main screen
font1 := Font.New ("Bush ScriptMT:50")
Font.Draw ("This is the ball throwing game", 100, 600, font1, red)
Font.Free (font1)
font1 := Font.New ("Castellar:50")
Font.Draw ("1.Instructions", 530, 394, font1, brightblue)
Font.Free (font1)
font2 := Font.New ("Castellar:50")
Font.Draw ("2.Start the game", 520, 320, font2, brightblue)
Font.Free (font2)
get start
if start = 1 then
cls
drawfill (10, 10, brightblue, black)
font3 := Font.New ("arial:50")
Font.Draw ("Instructions", 610, 620, font3, brightred)
Font.Free (font3)
color (brightblue)
locate (20, 60)
put "Click somewhere under the black line to launch the ball from the cannon" ..
locate (21, 60)
put "All you have to do is try to hit the target"
locate (22, 60)
put "Every time you hit the target you will get 20 points"
locate (23, 60)
put "You will lose 20 points for everytime you miss the target"
locate (24, 60)
put "Hope you like my game and have fun"
Input.Pause
cls
end if
if start = 2 then
cls
end if
%Target procedure
procedure target
drawfilloval (ovalx, ovaly, rady, rady, brightred)
drawfilloval (ovalx, ovaly, 14, 14, white)
drawfilloval (ovalx, ovaly, 8, 8, brightred)
end target
%Procedure ball
procedure ball
for i : 1 .. 1000 by 2
displacement := round (1 / 250 * (- (i - 40 * force) ** 2 + (40 * force) ** 2))
drawfilloval (launchx + i, launchy + displacement, radx, radx, blue)
drawfilloval (ovalx, ovaly, rady, rady, brightred)
drawfilloval (ovalx, ovaly, 14, 14, white)
drawfilloval (ovalx, ovaly, 8, 8, brightred)
Draw.ThickLine (1, 150, 2000, 150, 5, black)
setscreen ("offscreenonly")
Draw.ThickLine (1, 150, 2000, 150, 5, black)
View.Update
cls
end for
end ball
%Force of the ball
color (black)
locate (20, 60)
put "What force do you want a use?"
delay (100)
locate (21, 75)
put "Choose a force from 1-10 and hit any key to continue"
get force
if force = 1 then
force := 1
elsif force = 2 then
force := 2
elsif force = 3 then
force := 3
elsif force = 4 then
force := 4
elsif force = 5 then
force := 5
elsif force = 6 then
force := 6
elsif force = 7 then
force := 7
elsif force = 8 then
force := 8
elsif force = 9 then
force := 9
elsif force = 10 then
force := 10
end if
colorback (white)
cls
loop
%Thickline
Draw.ThickLine (1, 150, 2000, 150, 5, black)
%Buttonwait
target
View.Update
buttonwait ("down", launchx, launchy, buttonnumber, buttonupdown)
if launchx > 1 and launchx < 2000 and launchy < 150 and launchy > 10 then
ball
Draw.ThickLine (1, 150, 2000, 150, 5, black)
ovalx := Rand.Int (1, 615)
ovaly := Rand.Int (150, 390)
cls
target
else
locate (20, 60)
put "Please click somewhere under the black line"
delay (600)
end if
end loop |