Compare commits
No commits in common. "e029672bb6da1637e846398440a4dce457ed3260" and "2439711358a1f932e0e3949030cc496c9777d814" have entirely different histories.
e029672bb6
...
2439711358
2 changed files with 11 additions and 91 deletions
|
@ -28,17 +28,6 @@ font["f"] = {
|
||||||
{0, 0, 0.7, 0},
|
{0, 0, 0.7, 0},
|
||||||
{0, 0.5, 0.5, 0.5},
|
{0, 0.5, 0.5, 0.5},
|
||||||
}
|
}
|
||||||
font["g"] = {
|
|
||||||
{0, 0.2, 0.2, 0},
|
|
||||||
{0.2, 0, 0.5, 0},
|
|
||||||
{0.5, 0, 0.7, 0.2},
|
|
||||||
{0, 0.2, 0, 0.8},
|
|
||||||
{0, 0.8, 0.2, 1},
|
|
||||||
{0.2, 1, 0.5, 1},
|
|
||||||
{0.5, 1, 0.7, 0.8},
|
|
||||||
{0.7, 0.8, 0.7, 0.6},
|
|
||||||
{0.7, 0.6, 0.5, 0.6},
|
|
||||||
}
|
|
||||||
font["i"] = {
|
font["i"] = {
|
||||||
{0.1, 0, 0.6, 0},
|
{0.1, 0, 0.6, 0},
|
||||||
{0.35, 0, 0.35, 1},
|
{0.35, 0, 0.35, 1},
|
||||||
|
@ -54,12 +43,6 @@ font["l"] = {
|
||||||
{0, 0, 0, 1},
|
{0, 0, 0, 1},
|
||||||
{0, 1, 0.7, 1},
|
{0, 1, 0.7, 1},
|
||||||
}
|
}
|
||||||
font["m"] = {
|
|
||||||
{0, 1, 0.175, 0},
|
|
||||||
{0.175, 0, 0.35, 1},
|
|
||||||
{0.35, 1, 0.525, 0},
|
|
||||||
{0.525, 0, 0.7, 1},
|
|
||||||
}
|
|
||||||
font["o"] = {
|
font["o"] = {
|
||||||
{0, 0.2, 0.2, 0},
|
{0, 0.2, 0.2, 0},
|
||||||
{0.2, 0, 0.5, 0},
|
{0.2, 0, 0.5, 0},
|
||||||
|
@ -70,17 +53,6 @@ font["o"] = {
|
||||||
{0.5, 1, 0.7, 0.8},
|
{0.5, 1, 0.7, 0.8},
|
||||||
{0.7, 0.2, 0.7, 0.8},
|
{0.7, 0.2, 0.7, 0.8},
|
||||||
}
|
}
|
||||||
font["q"] = {
|
|
||||||
{0, 0.2, 0.2, 0},
|
|
||||||
{0.2, 0, 0.5, 0},
|
|
||||||
{0.5, 0, 0.7, 0.2},
|
|
||||||
{0, 0.2, 0, 0.8},
|
|
||||||
{0, 0.8, 0.2, 1},
|
|
||||||
{0.2, 1, 0.5, 1},
|
|
||||||
{0.5, 1, 0.7, 0.8},
|
|
||||||
{0.7, 0.2, 0.7, 0.8},
|
|
||||||
{0.5, 0.7, 0.7, 1},
|
|
||||||
}
|
|
||||||
font["r"] = {
|
font["r"] = {
|
||||||
{0, 0, 0, 1},
|
{0, 0, 0, 1},
|
||||||
{0, 0, 0.5, 0},
|
{0, 0, 0.5, 0},
|
||||||
|
@ -107,13 +79,6 @@ font["t"] = {
|
||||||
{0, 0, 0.7, 0},
|
{0, 0, 0.7, 0},
|
||||||
{0.35, 0, 0.35, 1},
|
{0.35, 0, 0.35, 1},
|
||||||
}
|
}
|
||||||
font["u"] = {
|
|
||||||
{0, 0, 0, 0.8},
|
|
||||||
{0, 0.8, 0.2, 1},
|
|
||||||
{0.2, 1, 0.5, 1},
|
|
||||||
{0.5, 1, 0.7, 0.8},
|
|
||||||
{0.7, 0.8, 0.7, 0},
|
|
||||||
}
|
|
||||||
font["v"] = {
|
font["v"] = {
|
||||||
{0, 0, 0.35, 1},
|
{0, 0, 0.35, 1},
|
||||||
{0.35, 1, 0.7, 0},
|
{0.35, 1, 0.7, 0},
|
||||||
|
|
|
@ -34,7 +34,7 @@ local enemy_inaccuracy = 0.05
|
||||||
local intro_duration = 1
|
local intro_duration = 1
|
||||||
local outro_duration = 0.5
|
local outro_duration = 0.5
|
||||||
|
|
||||||
local stage = nil
|
local stage = 1
|
||||||
|
|
||||||
local window_width = nil
|
local window_width = nil
|
||||||
local window_height = nil
|
local window_height = nil
|
||||||
|
@ -44,7 +44,7 @@ local scale = nil
|
||||||
|
|
||||||
local time = nil
|
local time = nil
|
||||||
|
|
||||||
local states = {title = 0, intro = 1, outro = 2, gameplay = 3, game_over = 4}
|
local states = {title = 0, intro = 1, outro = 2, gameplay = 3}
|
||||||
local state = nil
|
local state = nil
|
||||||
|
|
||||||
font = require("font")
|
font = require("font")
|
||||||
|
@ -154,8 +154,6 @@ function love.load()
|
||||||
cities = {}
|
cities = {}
|
||||||
spawnCities()
|
spawnCities()
|
||||||
|
|
||||||
stage = 1
|
|
||||||
|
|
||||||
state = states.title
|
state = states.title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -367,26 +365,10 @@ function updateEnemies(dt)
|
||||||
if enemy.until_shoot < 0 then
|
if enemy.until_shoot < 0 then
|
||||||
enemy.until_shoot = enemy_min_shoot + math.random() * (enemy_max_shoot - enemy_min_shoot)
|
enemy.until_shoot = enemy_min_shoot + math.random() * (enemy_max_shoot - enemy_min_shoot)
|
||||||
if unreflected_missiles < unreflected_missiles_allowed then
|
if unreflected_missiles < unreflected_missiles_allowed then
|
||||||
local speed = missile_speed_min + math.random() * (missile_speed_max - missile_speed_min)
|
local target = cities[math.random(1, #cities)]
|
||||||
local inaccuracy = math.random() * 2 * enemy_inaccuracy - enemy_inaccuracy
|
local inaccuracy = math.random() * 2 * enemy_inaccuracy - enemy_inaccuracy
|
||||||
local behaviour = math.random(0, 7)
|
local speed = missile_speed_min + math.random() * (missile_speed_max - missile_speed_min)
|
||||||
if behaviour == 0 then
|
spawnMissile(enemy.x, enemy.y, target.x + inaccuracy, target.y, speed)
|
||||||
spawnMissile(enemy.x, enemy.y, enemy.x + inaccuracy, 1, speed)
|
|
||||||
elseif behaviour <= 5 then
|
|
||||||
local target = cities[math.random(1, #cities)]
|
|
||||||
for i = 1, 7 do
|
|
||||||
if target.alive then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
target = cities[math.random(1, #cities)]
|
|
||||||
end
|
|
||||||
spawnMissile(enemy.x, enemy.y, target.x + inaccuracy, target.y, speed)
|
|
||||||
else
|
|
||||||
local angle = (math.random() * 140 - 70) * math.pi / 180
|
|
||||||
local x = enemy.x + math.sin(angle)
|
|
||||||
local y = enemy.y + math.cos(angle)
|
|
||||||
spawnMissile(enemy.x, enemy.y, x, y, speed)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -412,13 +394,7 @@ function love.update(dt)
|
||||||
unreflected_missiles_allowed = unreflected_missiles_allowed + 1
|
unreflected_missiles_allowed = unreflected_missiles_allowed + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local cities_remaining = 0
|
if #enemies == 0 then
|
||||||
for _, city in ipairs(cities) do
|
|
||||||
if city.alive then
|
|
||||||
cities_remaining = cities_remaining + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if cities_remaining == 0 or #enemies == 0 then
|
|
||||||
state = states.outro
|
state = states.outro
|
||||||
time = 0
|
time = 0
|
||||||
explodeAllMissiles()
|
explodeAllMissiles()
|
||||||
|
@ -430,21 +406,8 @@ function love.update(dt)
|
||||||
if #explosions == 0 then
|
if #explosions == 0 then
|
||||||
time = time + dt
|
time = time + dt
|
||||||
if time >= outro_duration then
|
if time >= outro_duration then
|
||||||
local cities_remaining = 0
|
stage = stage + 1
|
||||||
for _, city in ipairs(cities) do
|
startStage()
|
||||||
if city.alive then
|
|
||||||
cities_remaining = cities_remaining + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if cities_remaining == 0 then
|
|
||||||
love.mouse.setVisible(true)
|
|
||||||
love.mouse.setGrabbed(false)
|
|
||||||
state = states.game_over
|
|
||||||
else
|
|
||||||
time = 0
|
|
||||||
stage = stage + 1
|
|
||||||
startStage()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif state == states.intro then
|
elseif state == states.intro then
|
||||||
|
@ -480,7 +443,7 @@ function movePaddle(screen_x)
|
||||||
paddle_x = fromScreenCoordinate(screen_x, 0)
|
paddle_x = fromScreenCoordinate(screen_x, 0)
|
||||||
paddle_x = math.max(paddle_x, paddle_width/2 + wall_thickness)
|
paddle_x = math.max(paddle_x, paddle_width/2 + wall_thickness)
|
||||||
paddle_x = math.min(paddle_x, 1 - (paddle_width/2 + wall_thickness))
|
paddle_x = math.min(paddle_x, 1 - (paddle_width/2 + wall_thickness))
|
||||||
paddle_y = 0.8
|
paddle_y = 0.9
|
||||||
end
|
end
|
||||||
|
|
||||||
love.mousemoved = movePaddle
|
love.mousemoved = movePaddle
|
||||||
|
@ -493,8 +456,6 @@ function love.mousepressed(x, y, button, istouch, presses)
|
||||||
explodeAllReflected()
|
explodeAllReflected()
|
||||||
elseif state == states.title then
|
elseif state == states.title then
|
||||||
startStage()
|
startStage()
|
||||||
elseif state == states.game_over then
|
|
||||||
love.event.quit()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -638,7 +599,7 @@ function drawTextCentered(y, text_scale, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
if state == states.gameplay or state == states.outro or state == states.intro or state == states.game_over then
|
if state == states.gameplay or state == states.outro or state == states.intro then
|
||||||
drawCities()
|
drawCities()
|
||||||
drawWalls()
|
drawWalls()
|
||||||
drawMissiles()
|
drawMissiles()
|
||||||
|
@ -648,13 +609,7 @@ function love.draw()
|
||||||
if state == states.intro then
|
if state == states.intro then
|
||||||
drawTextCentered(0.4, 0.1, "wave")
|
drawTextCentered(0.4, 0.1, "wave")
|
||||||
local number = tostring(stage)
|
local number = tostring(stage)
|
||||||
drawTextCentered(0.55, 0.07, number)
|
drawTextCentered(0.55, 0.1, number)
|
||||||
end
|
|
||||||
if state == states.game_over then
|
|
||||||
drawTextCentered(0.4, 0.1, "game over")
|
|
||||||
local number = tostring(stage)
|
|
||||||
drawTextCentered(0.55, 0.07, number)
|
|
||||||
drawTextCentered(0.7, 0.03, "click to quit")
|
|
||||||
end
|
end
|
||||||
elseif state == states.title then
|
elseif state == states.title then
|
||||||
drawTextCentered(0.3, 0.1, "reflect")
|
drawTextCentered(0.3, 0.1, "reflect")
|
||||||
|
|
Loading…
Reference in a new issue