diff --git a/game/enemy.json b/game/enemy.json index 6bc0630..4e0e0fb 100644 --- a/game/enemy.json +++ b/game/enemy.json @@ -24,18 +24,8 @@ ], "timer_0": [ { - "type": "spawn", - "object": "enemy.json", - "x": 1, - "y": 0, - "relative": true - }, - { - "type": "spawn", - "object": "enemy.json", - "x": 0, - "y": 1, - "relative": true + "type": "lua", + "function": "multiply" } ], "timer_1": [ diff --git a/game/enemy.lua b/game/enemy.lua index 18a32fc..6da03fa 100644 --- a/game/enemy.lua +++ b/game/enemy.lua @@ -1,5 +1,5 @@ function enemy_bullet(e, instance) - local rand = math.random(0,3) -- 25% chance + local rand = math.random(0,1) -- 50% chance if (rand == 0) then local angle = math.random(0, 359)*(math.pi/180) @@ -10,3 +10,12 @@ function enemy_bullet(e, instance) action(e, bullet, '"type": "speed", "h": ' .. h .. ', "v": ' .. v) end end + +function multiply(e, instance) + local rand = math.random(0,1) + if (rand == 0) + then + spawn(e, instance, "enemy.json", 1, 0, true) + spawn(e, instance, "enemy.json", 0, 1, true) + end +end diff --git a/game/room.json b/game/room.json index 6cc0329..c1f02e7 100644 --- a/game/room.json +++ b/game/room.json @@ -46,7 +46,7 @@ { "type": "timer", "num": 0, - "time": 10 + "time": 5 } ], "timer_1": [