X Tutup
Skip to content

Commit c925bd8

Browse files
committed
enemies drop energy
1 parent d562354 commit c925bd8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

main.moon

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ class Game
153153
.disable_project = not .disable_project
154154
false
155155

156-
mousepressed: (x,y) =>
156+
mousepressed: (x,y, btn) =>
157157
x, y = @world.viewport\unproject x,y
158158
-- @world.particles\add EnergyEmitter @world, x,y
159-
-- @world.entities\add Energy x,y
159+
160+
if btn == "r"
161+
@world.entities\add Energy x,y
160162
-- print "boom: #{x}, #{y}"
161163
-- @world.particles\add Explosion @world, x,y
162164

tank.moon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ class Player extends Tank
185185

186186
enemy_killed: (thing, world) =>
187187
@score += thing.score if thing.score
188+
if math.random! > 0.5
189+
world.entities\add Energy thing.x, thing.y
188190

189191
draw: =>
190192
super!

0 commit comments

Comments
 (0)
X Tutup