Day 42
parent
87a2865095
commit
a766914dc7
60
arena.lua
60
arena.lua
|
@ -105,7 +105,9 @@ function Arena:on_enter(from, level, units)
|
|||
self.t:after(0.5, function()
|
||||
local spawn_type = random:table{'left', 'middle', 'right'}
|
||||
local spawn_points = {left = {x = self.x1 + 32, y = gh/2}, middle = {x = gw/2, y = gh/2}, right = {x = self.x2 - 32, y = gh/2}}
|
||||
self:spawn_n_enemies(spawn_points[spawn_type], nil, 8 + (self.wave-1)*2)
|
||||
local p = spawn_points[spawn_type]
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, nil, 8 + (self.wave-1)*2) end)
|
||||
end)
|
||||
end, self.max_waves+1)
|
||||
end)
|
||||
|
@ -481,32 +483,60 @@ function Arena:spawn_distributed_enemies()
|
|||
local spawn_type = t[random:weighted_pick(40, 20, 5, 15, 5, 15)]
|
||||
local spawn_points = table.copy(self.spawn_points)
|
||||
if spawn_type == '4' then
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points))
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function()
|
||||
self:spawn_n_enemies(p)
|
||||
end)
|
||||
elseif spawn_type == '4+4' then
|
||||
local p = random:table_remove(spawn_points)
|
||||
self:spawn_n_enemies(p)
|
||||
self.t:after(2, function() self:spawn_n_enemies(p) end)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function()
|
||||
self:spawn_n_enemies(p)
|
||||
self.t:after(2, function() self:spawn_n_enemies(p) end)
|
||||
end)
|
||||
elseif spawn_type == '4+4+4' then
|
||||
local p = random:table_remove(spawn_points)
|
||||
self:spawn_n_enemies(p)
|
||||
self.t:after(1, function()
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function()
|
||||
self:spawn_n_enemies(p)
|
||||
self.t:after(1, function()
|
||||
self:spawn_n_enemies(p)
|
||||
self.t:after(1, function()
|
||||
self:spawn_n_enemies(p)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
elseif spawn_type == '2x4' then
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 1)
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 2)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 1) end)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 2) end)
|
||||
elseif spawn_type == '3x4' then
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 1)
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 2)
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 3)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 1) end)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 2) end)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 3) end)
|
||||
elseif spawn_type == '4x2' then
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 1, 2)
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 2, 2)
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 3, 2)
|
||||
self:spawn_n_enemies(random:table_remove(spawn_points), 4, 2)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 1, 2) end)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 2, 2) end)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 3, 2) end)
|
||||
local p = random:table_remove(spawn_points)
|
||||
SpawnMarker{group = self.effects, x = p.x, y = p.y}
|
||||
self.t:after(0.75, function() self:spawn_n_enemies(p, 4, 2) end)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -755,3 +755,7 @@ In this example we can see a real use case of how this node system ties everythi
|
|||
|
||||
Mixins always will derive from Object and be created according to how classic says they should be. I'll only change it so that name collisions are detected and the program exits. This will be the main way to build
|
||||
objects and the last thing I need is random bugs because a function or variable from one mixin overwrote the other.
|
||||
|
||||
# Day 42 - 30/03/21
|
||||
|
||||
Added a spawn marker so that it's easier for the player to tell where enemies are spawning and to give a chance to avoid unfair deaths. Slowly getting back into it now...
|
||||
|
|
2
main.lua
2
main.lua
|
@ -58,6 +58,8 @@ function init()
|
|||
confirm1 = Sound('80921__justinbw__buttonchime02up.ogg', s)
|
||||
heal1 = Sound('Buff 3.ogg', s)
|
||||
spawn1 = Sound('Buff 13.ogg', s)
|
||||
spawn_mark1 = Sound('Bonus 2.ogg', s)
|
||||
spawn_mark2 = Sound('Bonus.ogg', s)
|
||||
alert1 = Sound('Click.ogg', s)
|
||||
elementor1 = Sound('Wind Bolt 18.ogg', s)
|
||||
saboteur_hit1 = Sound('Explosion Flesh_01.ogg', s)
|
||||
|
|
39
objects.lua
39
objects.lua
|
@ -1,3 +1,42 @@
|
|||
SpawnMarker = Object:extend()
|
||||
SpawnMarker:implement(GameObject)
|
||||
function SpawnMarker:init(args)
|
||||
self:init_game_object(args)
|
||||
self.color = red[0]
|
||||
self.r = random:float(0, 2*math.pi)
|
||||
self.spring:pull(random:float(0.4, 0.6), 200, 10)
|
||||
self.t:after(0.75, function() self.dead = true end)
|
||||
self.m = 1
|
||||
self.n = 0
|
||||
pop3:play{pitch = 1, volume = 0.15}
|
||||
self.t:every({0.11, 0.14}, function()
|
||||
self.hidden = not self.hidden
|
||||
self.m = self.m*random:float(0.84, 0.87)
|
||||
end, nil, nil, 'blink')
|
||||
end
|
||||
|
||||
|
||||
function SpawnMarker:update(dt)
|
||||
self:update_game_object(dt)
|
||||
self.t:set_every_multiplier('blink', self.m)
|
||||
end
|
||||
|
||||
|
||||
function SpawnMarker:draw()
|
||||
if self.hidden then return end
|
||||
graphics.push(self.x, self.y, self.r, self.spring.x, self.spring.x)
|
||||
graphics.push(self.x, self.y, self.r + math.pi/4)
|
||||
graphics.rectangle(self.x, self.y, 24, 6, 4, 4, self.color)
|
||||
graphics.pop()
|
||||
graphics.push(self.x, self.y, self.r + 3*math.pi/4)
|
||||
graphics.rectangle(self.x, self.y, 24, 6, 4, 4, self.color)
|
||||
graphics.pop()
|
||||
graphics.pop()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
LightningLine = Object:extend()
|
||||
LightningLine:implement(GameObject)
|
||||
function LightningLine:init(args)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Release Patch Notes
|
||||
|
||||
|
||||
Added a spawn marker before enemies spawn to help with avoiding enemies spawning on top of the player
|
||||
|
|
2
todo
2
todo
|
@ -1,4 +1,4 @@
|
|||
1. Enemy spawn points should have some markers before enemy spawns, or should avoid spawning near the player at all
|
||||
* 1. Enemy spawn points should have some markers before enemy spawns, or should avoid spawning near the player at all
|
||||
2. Prevent spawning of units that cost 3 on first level
|
||||
3. Prevent spawning of units that don't attack on first level
|
||||
|
||||
|
|
Loading…
Reference in New Issue