scenes/level: replace the gfx object by the gamecore one
This commit is contained in:
parent
3bf8fe3c1d
commit
edfe860c26
|
@ -1,30 +0,0 @@
|
|||
local Entity = require "scenes.levels.entities.parent"
|
||||
local Animator = require "core.modules.assets.animator"
|
||||
|
||||
local GFX = Entity:extend()
|
||||
|
||||
function GFX:new(world, x, y, spritename, animID)
|
||||
local width, height
|
||||
self.name = spritename
|
||||
self.animID = animID
|
||||
width = 16
|
||||
height = 16
|
||||
GFX.super.new(self, world, "gfx", x - (width/2), y - (height/2), width, height)
|
||||
self.animation = self.scene.assets.sprites[spritename]:clone()
|
||||
self.duration = self.animation:getAnimationDuration()
|
||||
self.timer = 0
|
||||
end
|
||||
|
||||
function GFX:update(dt)
|
||||
self.timer = self.timer + dt
|
||||
self.animation:update(dt)
|
||||
if (self.timer >= self.duration) then
|
||||
self:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
function GFX:draw(dt)
|
||||
self.animation:draw(self.x, self.y)
|
||||
end
|
||||
|
||||
return GFX
|
|
@ -8,11 +8,12 @@ Obj.Coin = require "scenes.levels.entities.loot.coin"
|
|||
Obj.Coin5 = require "scenes.levels.entities.loot.coin5"
|
||||
Obj.Coin10 = require "scenes.levels.entities.loot.coin10"
|
||||
Obj.Weapon = require "scenes.levels.entities.weapon"
|
||||
Obj.GFX = require "scenes.levels.entities.gfx.gfx"
|
||||
Obj.Numbers = require "scenes.levels.entities.gfx.numbers"
|
||||
Obj.Debris = require "scenes.levels.entities.debris"
|
||||
Obj.Player = require "scenes.levels.entities.player"
|
||||
|
||||
Obj.GFX = require "core.modules.world.actors.gfx2D"
|
||||
|
||||
Obj.Ennemy = require "scenes.levels.entities.ennemies.parent"
|
||||
|
||||
Obj.index = {}
|
||||
|
|
Loading…
Reference in New Issue