If state = "menu" Then
GraphicsWindow.Clear()
If GraphicsWindow.LastKey = keyOne then
number_of_tvs = 3
Begin_Game()
elseIf GraphicsWindow.LastKey = keyTwo then
number_of_tvs = 8
Begin_Game()
elseIf GraphicsWindow.LastKey = keyThree then
number_of_tvs = 12
Begin_Game()
elseIf GraphicsWindow.LastKey = keyFour then
Program.End()
EndIf
ElseIf state = "game" Then
If GraphicsWindow.LastKey = right Then
radioX = radioX + 10
If radioX > 570 Then
radioX = 570
endIf
Shapes.Move(radio, radioX, GraphicsWindow.Height - 65)
elseIf GraphicsWindow.LastKey = left Then
radioX = radioX - 10
If radioX < 5 Then
radioX = 5
endIf
Shapes.Move(radio, radioX, GraphicsWindow.Height - 65)
elseIf GraphicsWindow.LastKey = keyM then
Init_Stuff()
Splash_Screen()
elseIf GraphicsWindow.LastKey = keyQ then
Program.End()
endif
endIf
endSub
' ======================
' check for collisions
'======================
Sub Collision_Checker
For i = 1 to number_of_bullets
For j = 1 To number_of_tvs
If bulletActive[i] = 1 then
' determine if there is a collision by measuring the delta x and y values
thisTVx = Shapes.GetLeft(tv[j]) + 15
thisTVy = Shapes.GetTop(tv[j]) + 69
' hide the tv and move it below the screen
Shapes.HideShape(tv[j])
tvY[j] = 500
Shapes.Move(tv[j],tvX[j],tvY[j])
Shapes.ShowShape(tv[j])
Shapes.HideShape(bullet[i])
'create the explosion
Make_boom()
endIf
endIf
endFor
endFor
endSub
'===============================
' Update the scorebox
'===============================
Sub Update_Scorebox
GraphicsWindow.BrushColor = "#ffe5aa"
GraphicsWindow.FillRectangle(2,2,198,33)
GraphicsWindow.BrushColor = "#b04c4b"
GraphicsWindow.FontSize = 10
GraphicsWindow.FontBold = "True"
GraphicsWindow.DrawText(3,5,"Score: "+score+" hits "+misses+" misses "+landedTVs+" landed TVs")
GraphicsWindow.DrawText(3,18,"M to Quit to Menu")
endSub
'===============================
' Animate the explosion
'===============================
Sub Make_boom
boomx = thisTVx
boomy = thisTVy
thisTVx = 0
thisTVy = 0
For b = 1 To 16
Shapes.Move(boom[b],boomx - 15,boomy - 30)
Shapes.ShowShape(boom[b])
Program.Delay(70)
Shapes.HideShape(boom[b])
EndFor
endSub
'===============================
' Splash Screen and Menu
'===============================
Sub Splash_Screen
background = ImageList.LoadImage( Path + "\chicago.gif")
GraphicsWindow.FontSize = "12"
GraphicsWindow.Title = "Old Time Radio Blaster Game"
GraphicsWindow.Show()
Program.Delay(10)
'For i = 100 to 530
' Shapes.ShowShape(my_p_bar)
' Shapes.Move(my_p_bar,i,90)
' Program.Delay(10)
'endFor
Shapes.HideShape(my_p_bar)
GraphicsWindow.Clear()
GraphicsWindow.DrawImage(background, 0, 0)
' Load a Static TV
staticTV = ImageList.LoadImage( Path + "\Antique_Television-small.png")
GraphicsWindow.DrawImage(staticTV, 560,20)
' Load a Static Radio
staticRadio = ImageList.LoadImage( Path + "\oldradio-small.png")
GraphicsWindow.DrawImage(staticRadio, 25,32)
GraphicsWindow.BrushColor="Black"
GraphicsWindow.FontSize = 30
GraphicsWindow.FontBold = "True"
GraphicsWindow.DrawText(95,30,"Old Time Radio Blaster Game")
Play = 2
GraphicsWindow.FontSize = 15
GraphicsWindow.BrushColor = "yellow"
GraphicsWindow.DrawText(120,70,"Use your skills to stop the invasion of the televisions")
GraphicsWindow.DrawText(185,85,"and their threat of world domination. ")
mText[4] = "Use the keyboard arrow keys to move your Radio Blaster left and right."
mText[5] = "Use the left button on the mouse to launch Radio Tower Projectiles."
mText[6] = ""
mText[7] = "1. Level 1 - Easy (3 targets at a time, 3 landed TVs loses)"
mText[8] = "2. Level 2 - Medium (8 targets at a time, 8 landed TVs loses)"
mText[9] = "3. Level 3 - Easy (12 targets at a time, 12 landed TVs loses)"
mText[10] = "4. Quit"
For i = 4 to 6
LineLocation = LineLocation + 17
GraphicsWindow.DrawText(120,LineLocation,mText[i])
endFor
For i = 7 to 10
LineLocation = LineLocation + 17
GraphicsWindow.DrawText(170,LineLocation,mText[i])
endFor
GraphicsWindow.DrawText(170,425,"Make a Choice")
GraphicsWindow.FontBold = "False"
state = "menu"
endSub
Sub You_Lose
Timer.Pause()
For i = 1 to number_of_tvs
Shapes.HideShape(tv[i])
endfor
GraphicsWindow.BrushColor="#ffff95"
GraphicsWindow.FontSize = 30
GraphicsWindow.FontBold = "True"
GraphicsWindow.DrawText(225,35,"You Lose!")
For i = 1 To 60
tvMassX[i] = Math.GetRandomNumber(520)+60
tvMassY[i] = Math.GetRandomNumber(375)
tvMassY[i] = -tvMassY[i]
tvMass[i] = Shapes.AddImage(Path + "\Antique_Television-small.png")
Shapes.Move(tvMass[i],tvMassX[i],tvMassY[i])
Shapes.Animate(tvMass[i],tvMassX[i],380,3000)
endFor
endSub