MoneyText = Shapes.AddText("You Have " + Money + "$")
Shapes.Move(MoneyText,GraphicsWindow.Width - 100,10)
Img = ImageList.LoadImage("http://www.sean.alyrica.net/TD/Background.Png")
For i10 = 1 to GraphicsWindow.Width Step 175
For i11 = 1 To GraphicsWindow.Height Step 125
GraphicsWindow.DrawImage(Img,i10,i11)
EndFor
EndFor
NumOfTurretTypes = 6 '<-- This MUST be set to the number of turrets Types!!!
'------Turret Properties--------------------------------------------------------------------
TurretPic[1]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base.Png" 'The Stationary part Pic
TurretPic[1]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top.Png" 'The Turning part Pic
TurretPic[1]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img
TurretProp[1]["Name"] = "Type 1 Turret" 'Turret Name
TurretProp[1]["BallSize"] = 5 'Ball Size (If Projectile is set to Ball)
TurretProp[1]["BallColor"] = "Black" 'Ball Color (If Projectile is set to Ball)
TurretProp[1]["Price"] = 25 'Cost in $
TurretProp[1]["Speed"] = 100 'Velocity
TurretProp[1]["ROF"] = 500 'Rate Of Fire. In Millseconds Length in between fireing
TurretProp[1]["Damage"] = 400 'The Damage it does to the tank when it fires
TurretProp[1]["Range"] = 200
'------------------------------------------------------------------------------------------------
TurretPic[2]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base2.Png" 'The Stationary part Pic
TurretPic[2]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top2.Png" 'The Turning part Pic
TurretPic[2]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img
TurretProp[2]["Name"] = "Type 2 Turret" 'Turret Name
TurretProp[2]["BallSize"] = 10 'Ball Size (If Projectile is set to Ball)
TurretProp[2]["BallColor"] = "Blue" 'Ball Color (If Projectile is set to Ball)
TurretProp[2]["Price"] = 50 'Cost in $
TurretProp[2]["Speed"] = 125 'Velocity
TurretProp[2]["ROF"] = 1250 'Rate Of Fire. In Millseconds Length in between fireing
TurretProp[2]["Damage"] = 1000 'The Damage it does to the tank when it fires
TurretProp[2]["Range"] = 200
'-------------------------------------------------------------------------------------------------
TurretPic[3]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base3.Png" 'The Stationary part Pic
TurretPic[3]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top4.Png" 'The Turning part Pic
TurretPic[3]["Projectile"]["Path"] = "http://sean.alyrica.net/TD/Missile2.Png" 'Set to Ball For Ball Or The file path for a img
TurretProp[3]["Name"] = "Type 1 Missile Launcher" 'Turret Name
TurretProp[3]["BallSize"] = 15 'Ball Size (If Projectile is set to Ball)
TurretProp[3]["BallColor"] = "Red" 'Ball Color (If Projectile is set to Ball)
TurretProp[3]["Price"] = 150 'Cost in $
TurretProp[3]["Speed"] = 100 'Velocity
TurretProp[3]["ROF"] = 1550 'Rate Of Fire. In Millseconds Length in between fireing
TurretProp[3]["Damage"] = 2000 'The Damage it does to the tank when it fires
TurretProp[3]["Range"] = 300
'--------------------------------------------------------------------------------------------------
TurretPic[4]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base3.Png" 'The Stationary part Pic
TurretPic[4]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top5.Png" 'The Turning part Pic
TurretPic[4]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img
TurretProp[4]["Name"] = "Type 2 Missile Launcher" 'Turret Name
TurretProp[4]["BallSize"] = 15 'Ball Size (If Projectile is set to Ball)
TurretProp[4]["BallColor"] = "Orange" 'Ball Color (If Projectile is set to Ball)
TurretProp[4]["Price"] = 500 'Cost in $
TurretProp[4]["Speed"] = 200 'Velocity
TurretProp[4]["ROF"] = 1000 'Rate Of Fire. In Millseconds Length in between fireing
TurretProp[4]["Damage"] = 5000 'The Damage it does to the tank when it fires
TurretProp[4]["Range"] = 310
'--------------------------------------------------------------------------------------------------
TurretPic[5]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base4.Png" 'The Stationary part Pic
TurretPic[5]["Top"]["Path"] = "http://sean.alyrica.net/TD/TopAir.Png" 'The Turning part Pic
TurretPic[5]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img
TurretProp[5]["Name"] = "Rapid Fire Turret" 'Turret Name
TurretProp[5]["BallSize"] = 10 'Ball Size (If Projectile is set to Ball)
TurretProp[5]["BallColor"] = "Red" 'Ball Color (If Projectile is set to Ball)
TurretProp[5]["Price"] = 700 'Cost in $
TurretProp[5]["Speed"] = 150 'Velocity
TurretProp[5]["ROF"] = 250 'Rate Of Fire. In Millseconds Length in between fireing
TurretProp[5]["Damage"] = 1500 'The Damage it does to the tank when it fires
TurretProp[5]["Range"] = 310
'--------------------------------------------------------------------------------------------------
TurretPic[6]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base4.Png" 'The Stationary part Pic
TurretPic[6]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top6.Png" 'The Turning part Pic
TurretPic[6]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img
TurretProp[6]["Name"] = "Heavy Turret" 'Turret Name
TurretProp[6]["BallSize"] = 10 'Ball Size (If Projectile is set to Ball)
TurretProp[6]["BallColor"] = "Yellow" 'Ball Color (If Projectile is set to Ball)
TurretProp[6]["Price"] = 1000 'Cost in $
TurretProp[6]["Speed"] = 150 'Velocity
TurretProp[6]["ROF"] = 1500 'Rate Of Fire. In Millseconds Length in between fireing
TurretProp[6]["Damage"] = 10500 'The Damage it does to the tank when it fires
TurretProp[6]["Range"] = 250
For i = 1 To NumOfTurretTypes
ImgTop[i] = ImageList.LoadImage(TurretPic[i]["Top"]["Path"])
ImgBase[i] = ImageList.LoadImage(TurretPic[i]["Base"]["Path"])
GraphicsWindow.DrawImage(ImgBase[i],i * 40,10)
GraphicsWindow.DrawImage(ImgTop[i],i * 40,5)
GraphicsWindow.DrawText(i * 40 + 5,40,TurretProp[i]["Price"] + " $")
EndFor
AddTanks()
GraphicsWindow.ShowMessage("To grab a turret, click on it and place it where you want. if you want to see how many kills it has, put your cursor over it.","Tankinator")
BeginGameTime = Clock.ElapsedMilliseconds
While Out < NumOfTanksAllowedOut
Program.Delay(5)
OldTimeStart2 = Timestart2
Timestart2 = Clock.ElapsedMilliseconds
TimeElapsed2 = Timestart2 - OldTimeStart2
If TimeElapsed2 / 20 < 5 Then
TankSpeed = TimeElapsed2 / (20 -intTankSpeed)
EndIf
GraphicsWindow.Title = "Out = " + Out
Shapes.SetText(MoneyText,"You Have " + Money + "$")
If (Kills + OutThisRound) >= NumOfTanks Then
Kills = 0
AddTanks()
EndIf
MoveTanks()
SetAim()
CalcXY()
EndWhile
For i12 = 1 to TurretNum
Kills = Kills + TurretKills[i12]
EndFor
Score = Math.Round((Clock.ElapsedMilliseconds - BeginGameTime) * Kills / 1000)
GraphicsWindow.ShowMessage("You Lost :( Your score was " + Score,"Tower Defence")
While 1 = 1
Program.Delay(5)
For i1 = 1 To TurretNum
If GraphicsWindow.MouseX > Turret[i1][TurretType[i1]]["x"] And GraphicsWindow.MouseX < Turret[i1][TurretType[i1]]["x"] + 30 And GraphicsWindow.MouseY > Turret[i1][TurretType[i1]]["y"] And GraphicsWindow.MouseY < Turret[i1][TurretType[i1]]["y"] + 30 Then
Shapes.ShowShape(RangeCir[i1])
Shapes.ShowShape(KillsText[i1])
Shapes.ShowShape(TurretName[i1])
Else
Shapes.HideShape(RangeCir[i1])
Shapes.HideShape(KillsText[i1])
Shapes.HideShape(TurretName[i1])
EndIf
EndFor
EndWhile
Sub Fire
Sf = Sf + 1
If Sf > BallCount Then '<--- If the number of shots fired is more than the number of balls that can possible be on the screen, Then set it to One
Sf = 1
EndIf
If Ball[Turret2Fire][Sf] = "" Then
ProjCaps = Text.ConvertToUpperCase(BallPath[Turret2Fire])
If ProjCaps = "BALL" Then
Color = GraphicsWindow.BrushColor
GraphicsWindow.BrushColor = BallColor[Turret2Fire]
Ball[Turret2Fire][Sf] = Shapes.AddEllipse(BallSize[Turret2Fire],BallSize[Turret2Fire])
GraphicsWindow.BrushColor = Color
EndIf
If ProjCaps <> "BALL" And ProjCaps <> "" Then
For i = 1 To NumOfTurretTypes
If GraphicsWindow.MouseX > (i * 40) And GraphicsWindow.MouseX < (i * 40) + 30 And GraphicsWindow.MouseY > 10 And GraphicsWindow.MouseY < 40 Then
Clicked = "Yes"
TypeClicked = i
EndIf
EndFor
Sub CalcXY
For i1 = 1 To TurretNum
If TurretLive[i1] <> "No" Then
Shapes.SetText(KillsText[i1],"Kills: " + TurretKills[i1])
If GraphicsWindow.MouseX > Turret[i1][TurretType[i1]]["x"] And GraphicsWindow.MouseX < Turret[i1][TurretType[i1]]["x"] + 30 And GraphicsWindow.MouseY > Turret[i1][TurretType[i1]]["y"] And GraphicsWindow.MouseY < Turret[i1][TurretType[i1]]["y"] + 30 Then
Shapes.ShowShape(RangeCir[i1])
Shapes.ShowShape(KillsText[i1])
Shapes.ShowShape(TurretName[i1])
Else
Shapes.HideShape(RangeCir[i1])
Shapes.HideShape(KillsText[i1])
Shapes.HideShape(TurretName[i1])
EndIf
GetAngle()
Shapes.Rotate(Turret[i1][TurretType[i1]]["Top"],Angle[i1])
For i2 = 1 To BallCount
For i7 = 1 To NumOfTanks
If x[i1][i2] > Tankx[i7] And x[i1][i2] < Tankx[i7] + TankWidth And y[i1][i2] > Tanky[i7] And y[i1][i2] < Tanky[i7] + TankHeight Then
HitTank()
EndIf
If (Turret[i1][TurretType[i1]]["x"] + 30) >Tankx[i7] And Turret[i1][TurretType[i1]]["x"] < Tankx[i7] + TankWidth And Turret[i1][TurretType[i1]]["y"] + 15 > Tanky[i7] And Turret[i1][TurretType[i1]]["y"] < Tanky[i7] + TankHeight Then
T2D = i1
DeadAng[i1] = Angle[i1]
DestroyTurret()
EndIf
EndFor
Time[i1][i2] = Time[i1][i2] + .005
If CanCalcFire[i1] = "Yes" Then
TimeCurrent[i1] = Clock.ElapsedMilliseconds - TimeStart[i1]
EndIf
If TimeCurrent[i1] >= TurretProp[TurretType[i1]]["ROF"]Then
TimeStart[i1] = Clock.ElapsedMilliseconds
Turret2Fire = i1
Angle2Fire = Angle[i1]
TurretType2 = TurretType
Fire()
CanFire[i1] = "No"
EndIf