diff --git a/arena.lua b/arena.lua index 38996db..febeb26 100644 --- a/arena.lua +++ b/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 diff --git a/assets/sounds/Bonus 2.ogg b/assets/sounds/Bonus 2.ogg new file mode 100644 index 0000000..3fefb90 Binary files /dev/null and b/assets/sounds/Bonus 2.ogg differ diff --git a/assets/sounds/Bonus.ogg b/assets/sounds/Bonus.ogg new file mode 100644 index 0000000..45ff073 Binary files /dev/null and b/assets/sounds/Bonus.ogg differ diff --git a/assets/sounds/Debuff 15.ogg b/assets/sounds/Debuff 15.ogg new file mode 100644 index 0000000..ae1eb31 Binary files /dev/null and b/assets/sounds/Debuff 15.ogg differ diff --git a/devlog.md b/devlog.md index 05c0d71..080e57c 100644 --- a/devlog.md +++ b/devlog.md @@ -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... diff --git a/main.lua b/main.lua index 0d48b62..6ae9ae6 100644 --- a/main.lua +++ b/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) diff --git a/objects.lua b/objects.lua index 88e6608..766142e 100644 --- a/objects.lua +++ b/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) diff --git a/patch_notes.md b/patch_notes.md index a3fc4fe..f3cab9d 100644 --- a/patch_notes.md +++ b/patch_notes.md @@ -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 diff --git a/todo b/todo index 885ac8a..e540651 100644 --- a/todo +++ b/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