Permalink
Browse files

spread gun

  • Loading branch information...
1 parent 40e9244 commit 7f140869bfc6bb61ca383ce6e983cb5c1900ac1f @leafo committed Dec 17, 2012
Showing with 25 additions and 9 deletions.
  1. +19 −5 guns.moon
  2. BIN img/sprite.png
  3. +3 −2 main.moon
  4. BIN sounds/shoot1.wav
  5. +3 −2 tank.moon
View
@@ -25,6 +25,7 @@ class Bullet extends Box
-- kill bullet and return damage
on_hit: (thing, world) =>
+ sfx\play "hit1"
@alive = false
{min, max} = @damage
math.random! * (max - min) + min
@@ -118,10 +119,6 @@ class MachineGun extends Gun
sprite: "38,12,6,3"
size: 1
- on_hit: (...) =>
- sfx\play "hit1"
- super ...
-
spawn_bullet: (...) =>
sfx\play "machine-gun"
super ...
@@ -131,7 +128,7 @@ class TankGun extends Gun
recoil_2: 0.4
bullet: class extends SpriteBullet
- damage: {8,14}
+ damage: {8,16}
ox: 6
oy: 2
@@ -141,10 +138,27 @@ class TankGun extends Gun
world.particles\add Explosion.Fire @x, @y
super thing, world
+ spawn_bullet: (...) =>
+ sfx\play "shoot1"
+ super ...
+
class SpreadGun extends Gun
recoil_1: 0.1
recoil_2: 0.3
bullet: class extends SpriteBullet
+ ox: 3
+ oy: 3
+ damage: {6,7}
+ sprite: "40,18,7,7"
+ spawn_bullet: (vel, x,y) =>
+ sfx\play "shoot1"
+
+ left = vel\rotate -0.2
+ right = vel\rotate 0.2
+
+ @tank.world.entities\add self.bullet left, x,y, @tank
+ @tank.world.entities\add self.bullet vel, x,y, @tank
+ @tank.world.entities\add self.bullet right, x,y, @tank
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -119,7 +119,7 @@ class Game
new: =>
@player = Player 100, 100, @
- @current_level = 2
+ @current_level = 0
@load_next_world!
load_next_world: =>
@@ -197,11 +197,12 @@ love.load = ->
"machine-gun"
"hit1"
"hit2"
+ "shoot1"
"boom"
"energy-collect"
}
sfx.play_music = ->
- dispatch = Dispatcher Tutorial! -- Game!
+ dispatch = Dispatcher Game! -- Tutorial! -- Game!
dispatch\bind love
View
Binary file not shown.
View
@@ -141,8 +141,9 @@ class Player extends Tank
@ring_alpha = 0
loadout: =>
- @mount_gun MachineGun, 0, -4
- @mount_gun MachineGun, 0, 4
+ -- @mount_gun MachineGun, 0, -4
+ -- @mount_gun MachineGun, 0, 4
+ @mount_gun SpreadGun, 0, 0
shoot: (...) =>
return if @sucking

0 comments on commit 7f14086

Please sign in to comment.