Added small animations when bullets hit something

This commit is contained in:
Erkki Seppälä 2014-10-19 04:49:22 +03:00
parent 7cc7ec207d
commit aa11cbbb2e
6 changed files with 11 additions and 0 deletions

View file

@ -1,8 +1,10 @@
Class = require 'hump.class'
require 'entities/physicsentity'
require 'entities/animation'
require 'settings'
local TINYSHOT_SOUND = love.audio.newSource("resources/audio/chaingun.mp3", "static")
local explosionFrames = AnimationFrames("resources/graphics/miniexplosion-%04d.png", 4, 15)
TinyShot = Class{
__includes = Rectangle,
@ -34,6 +36,10 @@ TinyShot = Class{
end
end;
wasHit = function(self)
Animation(self.body:getX(), self.body:getY(), self.level, explosionFrames)
end;
draw = function(self)
love.graphics.setColor({255, 0, 0, 255})
Rectangle.draw(self)

View file

@ -3,6 +3,7 @@ require 'entities/physicsentity'
require 'settings'
local VICKERS_SOUND = love.audio.newSource("resources/audio/vickers77.mp3", "static")
local explosionFrames = AnimationFrames("resources/graphics/miniexplosion-%04d.png", 4, 15)
Vickers77 = Class{
__includes = Rectangle,
@ -35,6 +36,10 @@ Vickers77 = Class{
end
end;
wasHit = function(self)
Animation(self.body:getX(), self.body:getY(), self.level, explosionFrames)
end;
draw = function(self)
Rectangle.draw(self)
end;

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B