summaryrefslogtreecommitdiffhomepage
path: root/not/Effect.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-05-26 22:44:00 +0200
committerAki <nthirtyone@gmail.com>2017-05-26 22:44:00 +0200
commitb14d4608dc921f882067c43c71fcf04db7b2f794 (patch)
tree04c00f9dde638f0a1689f601f780975fdd158b24 /not/Effect.lua
parent81e72006a4ca0578f0bbc31d0788a6e0223fdb63 (diff)
downloadroflnauts-b14d4608dc921f882067c43c71fcf04db7b2f794.zip
roflnauts-b14d4608dc921f882067c43c71fcf04db7b2f794.tar.gz
roflnauts-b14d4608dc921f882067c43c71fcf04db7b2f794.tar.bz2
Rest of entities moved to new oop module; tested
Diffstat (limited to 'not/Effect.lua')
-rw-r--r--not/Effect.lua32
1 files changed, 12 insertions, 20 deletions
diff --git a/not/Effect.lua b/not/Effect.lua
index dd7570a..82d6819 100644
--- a/not/Effect.lua
+++ b/not/Effect.lua
@@ -1,29 +1,19 @@
+require "not.Decoration"
+
--- `Effect`
-- Short animation with graphics that plays in various situation.
-- TODO: animation is currently slower than it used to be, check if it is ok; if not then make it possible to change it to 0.06 delay.
-Effect = {
- finished = false,
-}
+Effect = Decoration:extends()
--- `Effect` is a child of `Decoration`.
-require "not.Decoration"
-Effect.__index = Effect
-setmetatable(Effect, Decoration)
+Effect.finished = false
-- Constructor of `Effect`.
-function Effect:new (name, x, y)
- local o = setmetatable({}, self)
- o:init(name, x, y)
- -- Load spritesheet statically.
- if self:getImage() == nil then
- self:setImage(Sprite.newImage("assets/effects.png"))
+function Effect:new (name, x, y, world)
+ -- TODO: Load spritesheet statically. Put it to load or somewhere else within non-existent resource manager.
+ if Effect:getImage() == nil then
+ Effect:setImage(Sprite.newImage("assets/effects.png"))
end
- return o
-end
-
--- Initializer of `Effect`.
-function Effect:init (name, x, y)
- Decoration.init(self, x, y, nil)
+ Effect.__super.new(self, x, y, world, nil)
self:setAnimationsList(require("config.animations.effects"))
self:setAnimation(name)
end
@@ -31,7 +21,7 @@ end
-- Update of `Effect`.
-- Returns true if animation is finished and effect is ready to be deleted.
function Effect:update (dt)
- Decoration.update(self, dt)
+ Effect.__super.update(self, dt)
return self.finished
end
@@ -44,3 +34,5 @@ function Effect:goToNextFrame ()
self.finished = true
end
end
+
+return Effect