diff --git a/entities/animation.lua b/entities/animation.lua index 9ffaa8f..9975487 100644 --- a/entities/animation.lua +++ b/entities/animation.lua @@ -4,7 +4,7 @@ require 'entities/entity' AnimationFrames = Class { frames = {}, - init = function(self, basename, numFrames, fps) + init = function(self, basename, numFrames, fps, fadeOut) for frame = 0, numFrames - 1 do self.frames[frame] = love.graphics.newImage(string.format(basename, frame)) end @@ -14,6 +14,7 @@ AnimationFrames = Class { self.width = self.frames[0]:getWidth(); self.height = self.frames[0]:getHeight(); self.quad = love.graphics.newQuad(0, 0, self.width, self.height, self.width, self.height) + self.fadeOout = fadeOut end } @@ -34,7 +35,11 @@ Animation = Class{ draw = function(self) local img = self.frames.frames[math.floor(self.curFrame)] if img then - love.graphics.setColor(255, 255, 255, 255 * (1.0 - self.curFrame / self.frames.numFrames)) + if self.frames.fadeOout then + love.graphics.setColor(255, 255, 255, 255 * (1.0 - self.curFrame / self.frames.numFrames)) + else + love.graphics.setColor(255, 255, 255) + end love.graphics.draw(img, self.frames.quad, self.x, self.y, self.angle, 1, 1, self.frames.width / 2, self.frames.width / 2) end end; diff --git a/entities/plane.lua b/entities/plane.lua index 05c6044..ee2d6da 100644 --- a/entities/plane.lua +++ b/entities/plane.lua @@ -31,7 +31,7 @@ local max_motorPower = ENGINE_MAX local plane_area = 10.0 local head_area = 1.0 -local explosionFrames = AnimationFrames("resources/graphics/explosion-%04d.png", 36, 15) +local explosionFrames = AnimationFrames("resources/graphics/explosion-%04d.png", 36, 15, true) Plane = Class{ __includes = PhysicsEntity, diff --git a/entities/tinyshot.lua b/entities/tinyshot.lua index 0371b7d..c7fe60f 100644 --- a/entities/tinyshot.lua +++ b/entities/tinyshot.lua @@ -4,7 +4,7 @@ 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) +local explosionFrames = AnimationFrames("resources/graphics/miniexplosion-%04d.png", 4, 15, false) TinyShot = Class{ __includes = Rectangle, diff --git a/entities/vickers77.lua b/entities/vickers77.lua index a69b290..d5fae4b 100644 --- a/entities/vickers77.lua +++ b/entities/vickers77.lua @@ -3,7 +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) +local explosionFrames = AnimationFrames("resources/graphics/miniexplosion-%04d.png", 4, 15, false) Vickers77 = Class{ __includes = Rectangle,