Skip to content

Commit

Permalink
Final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
EmperorPenguin18 committed Oct 1, 2023
1 parent eb4dd4c commit 97cae93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
14 changes: 2 additions & 12 deletions game/enemy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
11 changes: 10 additions & 1 deletion game/enemy.lua
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
2 changes: 1 addition & 1 deletion game/room.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{
"type": "timer",
"num": 0,
"time": 10
"time": 5
}
],
"timer_1": [
Expand Down

0 comments on commit 97cae93

Please sign in to comment.