xxxxxxxxxx
213
// initialize all global variables here
// major variables
let money = 150
let HP = 50
let wave = -1
waveTime = 0
waveComplete = true
let selectedTurret = null
selectedTurretSize = 0
let selectedTower = null
let placedTowers = []
// settings
let noFlashingLights = false
// effects
let flames = [] // {x: num, y: num, time: num}
melts = []
// colors
let bgCol = [0,0,30]
// track
let track = [
{
x1: 250,
y1: 450,
x2: 520,
y2: 450,
r: 0
},
{
x1: 520,
y1: 450,
x2: 570,
y2: 400,
r: -45
},
{
x1: 570,
y1: 400,
x2: 570,
y2: 300,
r: -90
},
{
x1: 570,
y1: 300,
x2: 520,
y2: 250,
r: -135
},
{
x1: 520,
y1: 250,
x2: 300,
y2: 250,
r: -180
},
{
x1: 300,
y1: 250,
x2: 250,
y2: 200,
r: -135
},
{
x1: 250,
y1: 200,
x2: 250,
y2: 125,
r: -90
},
{
x1: 250,
y1: 125,
x2: 300,
y2: 75,
r: -45
},
{
x1: 300,
y1: 75,
x2: 450,
y2: 75,
r: 0
}
]
// waves
function generateSection(type,count,delay, offset = 0){
let output = []
for(let i = 0; i < count; i++){
output[i] = [type,offset + delay*i]
}
return output
}
let waves = [
[
["basic",0],
["basic",2],
["basic",4],
["basic",6],
["basic",8]
],
[
["basic",0],
["basic",2],
["basic",4],
["basic",12],
["basic",6],
["basic",8],
["basic",10],
["basic",12],
["thonk",13]
],
[
["thonk",0],
["basic",1],
["basic",3],
["basic",5],
["thonk",5],
["basic",7]
],
[
["thonk",5],
["basic",1],
["speedy",3],
["basic",4],
["basic",7],
["speedy",10],
["basic",10]
],
[
["basic",0],
["basic",2],
["basic",4],
["thonk",5],
["speedy",6],
["speedy",8],
["speedy",10],
["speedy",12]
],
[
["basic",0],
["basic",1],
["basic",2],
["basic",3],
["basic",4],
["basic",5],
["basic",6],
["basic",7],
["basic",8],
["basic",9],
],
[
["thonk",0],
["thonk",3],
["thonk",6],
["thonk",9],
["thonk",12],
["speedy",8]
],
[
["speedy",0],
["speedy",2],
["stealthy",3],
["speedy",4],
["speedy",6],
["stealthy",7],
["speedy",8],
["speedy",10],
["stealthy",11],
["speedy",12],
["speedy",14]
],
[
["basic2",0],
["basic",1],
["basic2",2],
["basic2",3],
["basic",4],
["basic2",5],
["basic2",6],
["basic",7],
["basic2",8],
["basic2",9],
["basic",10],
["basic2",11]
],
[
["thonk",0],
["basic2",1],
["basic2",2],
["thonk",3],
["basic2",4],
["stealthy",5],
["thonk",6],
["basic2",7],
["stealthy",8],
["thonk",9],
["basic2",10],
["stealthy",11]
]
]