diff options
author | Aki <nthirtyone@gmail.com> | 2017-08-13 02:26:55 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-08-13 02:26:55 +0200 |
commit | b1cf14d64a2d3e28683db87190c4b2c7799c259d (patch) | |
tree | e45dac5cc6ce5265e3e3e2c914eb7cc92a820b8b /not/Effect.lua | |
parent | 0dd01913fe0eefc7ba4bc0797877f40fdedf9315 (diff) | |
parent | ed62b573417bdc85bec616f6016846b02de4c906 (diff) | |
download | roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.zip roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.gz roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.bz2 |
Merge branch 'multi'maps
Diffstat (limited to 'not/Effect.lua')
-rw-r--r-- | not/Effect.lua | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/not/Effect.lua b/not/Effect.lua index dd7570a..6c0dad0 100644 --- a/not/Effect.lua +++ b/not/Effect.lua @@ -1,29 +1,15 @@ --- `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` is a child of `Decoration`. -require "not.Decoration" -Effect.__index = Effect -setmetatable(Effect, Decoration) +Effect = require "not.Decoration":extends() -- 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.finished = false self:setAnimationsList(require("config.animations.effects")) self:setAnimation(name) end @@ -31,7 +17,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 +30,5 @@ function Effect:goToNextFrame () self.finished = true end end + +return Effect |