import GUI
%The Welcoming screen
Music.PlayFileLoop ("back.mp3")
var font1, font2 : int
font1 := Font.New ("serif:25")
font2 := Font.New ("serif:10")
Font.Draw ("The Dart Game", maxx div 3, maxy div 2, font1, red)
Font.Draw ("You get 20 darts", maxx div 3, maxy div 3, font1, red)
delay (3000)
cls
setscreen ("graphics")
var powerincrease : int := 22
var x, y, button : int
var darts : int := 20
var acore : int := 0
procedure hard
cls
Font.Draw ("Power Bar", 10, 5, font2, black)
View.Update
View.Set ("offscreenonly")
drawfilloval (maxx div 2, maxy div 2, 180, 180, 27)
drawfilloval (maxx div 2, maxy div 2, 140, 140, 64)
drawfilloval (maxx div 2, maxy div 2, 120, 120, 92)
drawfilloval (maxx div 2, maxy div 2, 80, 80, 69)
drawfilloval (maxx div 2, maxy div 2, 60, 60, 0)
drawfilloval (maxx div 2, maxy div 2, 15, 15, 33)
drawfilloval (maxx div 2, maxy div 2, 5, 5, 101)
drawfillbox (10, 21, maxx div 16, 22, red)
loop
loop
View.Update
delay (3)
powerincrease := powerincrease + 2
Mouse.Where (x, y, button)
if hasch then
if whatdotcolor (x, powerincrease) = 27 then
acore := acore + 0
elsif whatdotcolor (x, powerincrease) = 64 then
acore := acore + 5
elsif whatdotcolor (x, powerincrease) = 92 then
acore := acore + 10
elsif whatdotcolor (x, powerincrease) = 69 then
acore := acore + 15
elsif whatdotcolor (x, powerincrease) = 0 then
acore := acore + 20
elsif whatdotcolor (x, powerincrease) = 33 then
acore := acore + 25
elsif whatdotcolor (x, powerincrease) = 101 then
acore := acore + 30
elsif whatdotcolor (x, powerincrease) = red then
acore := acore + 50
end if
Music.PlayFile ("arrow.wav")
drawfilloval (x, powerincrease, 2, 2, black)
Music.SoundOff
Input.Flush
darts := darts - 1
end if
drawfillbox (10, 22, maxx div 16, powerincrease, red)
View.Update
exit when powerincrease >= maxy - 10
exit when darts = 0
end loop
loop
View.Update
drawfillbox (10, 22, maxx div 16, powerincrease, white)
powerincrease := 22
View.Update
drawfillbox (10, 22, maxx div 16, powerincrease, white)
View.Update
exit when powerincrease = 22
end loop
exit when darts = 0
end loop
cls
Font.Draw ("GAME OVER", maxx div 3, maxy div 2, font1, red)
put "Your score is: ", acore
if acore >= 200 then
Music.PlayFile ("unbelievable.wav")
end if
View.Update
end hard
cls
View.Update
procedure easy
cls
View.Set ("offscreenonly")
drawfilloval (maxx div 2, maxy div 2, 180, 180, 27)
drawfilloval (maxx div 2, maxy div 2, 140, 140, 64)
drawfilloval (maxx div 2, maxy div 2, 120, 120, 92)
drawfilloval (maxx div 2, maxy div 2, 80, 80, 69)
drawfilloval (maxx div 2, maxy div 2, 60, 60, 0)
drawfilloval (maxx div 2, maxy div 2, 15, 15, 33)
drawfilloval (maxx div 2, maxy div 2, 5, 5, 101)
drawfillbox (10, 21, maxx div 16, 22, red)
var powerincrease : int := 22
var x, y, button : int
var darts : int := 20
var acore : int := 0
loop
Font.Draw ("Power Bar", 10, 5, font2, black)
View.Update
loop
locate (maxrow, maxcol)
View.Update
delay (3)
powerincrease := powerincrease + 2
Mouse.Where (x, y, button)
if hasch then
if whatdotcolor (x, powerincrease) = 27 then
acore := acore + 0
elsif whatdotcolor (x, powerincrease) = 64 then
acore := acore + 5
elsif whatdotcolor (x, powerincrease) = 92 then
acore := acore + 10
elsif whatdotcolor (x, powerincrease) = 69 then
acore := acore + 15
elsif whatdotcolor (x, powerincrease) = 0 then
acore := acore + 20
elsif whatdotcolor (x, powerincrease) = 33 then
acore := acore + 25
elsif whatdotcolor (x, powerincrease) = 101 then
acore := acore + 30
elsif whatdotcolor (x, powerincrease) = red then
acore := acore + 50
end if
drawfilloval (x, powerincrease, 2, 2, black)
Music.PlayFile ("arrow.wav")
drawfilloval (x, powerincrease, 2, 2, black)
Music.SoundOff
Input.Flush
darts := darts - 1
end if
drawfillbox (10, 22, maxx div 16, powerincrease, red)
delay (3)
View.Update
exit when powerincrease >= maxy - 10
exit when darts = 0
end loop
loop
View.Update
drawfillbox (10, 22, maxx div 16, powerincrease, white)
powerincrease := 22
View.Update
drawfillbox (10, 22, maxx div 16, powerincrease, white)
View.Update
exit when powerincrease = 22
end loop
exit when darts = 0
end loop
cls
Font.Draw ("GAME OVER", maxx div 3, maxy div 2, font1, red)
put "Your score is: ", acore
if acore >= 200 then
Music.PlayFile ("unbelievable.wav")
end if
View.Update
end easy
cls
View.Update
put "Instructions"
put "------------"
put " "
put " "
put "You get 20 darts, and the point of the game is to get as"
put "high as a score as possible."
put "Use your mouse to aim horizontally, and the power bar to aim vertically."
put "Where the bar stops is where the dart ends up."
put "The most outer ring is 0 points, the ring inside is 5,"
put "then the next one is 10, and so on and so forth. The middle circle is 50 points."
put "Press any key to shoot the dart"
put "Have fun!"
var button1 : int := GUI.CreateButton (maxx div 2, maxy div 4, 0, "Hard Difficulty", hard)
var button2 : int := GUI.CreateButton (maxx div 2, maxy div 3, 0, "Easy Difficulty", easy)
loop
exit when GUI.ProcessEvent
end loop
|