refactor(levels): remove all functions already provided by Actor2D

This commit is contained in:
Kazhnuz 2019-06-16 18:45:18 +02:00
parent 666aa13565
commit 4ee17f01b6
1 changed files with 4 additions and 34 deletions

View File

@ -1,4 +1,5 @@
local Entity = Object:extend() -- On créer la classe des entitées, c'est la classe de base
local Base = require "core.modules.world.actors.actor2D"
local Entity = Base:extend() -- On créer la classe des entitées, c'est la classe de base
function Entity:new(world, type, x, y, w, h) -- On enregistre une nouvelle entité, avec par défaut sa hitbox.
self:initPhysics(world, type, x, y, w, h)
@ -8,10 +9,8 @@ function Entity:new(world, type, x, y, w, h) -- On enregistre une nouvelle entit
end
function Entity:initPhysics(world, type, x, y, w, h)
self.scene = world.scene
self.world = world
self:setManagers(world)
self.camera = self.scene.camera
self.obj = self.world.obj
self.type = type
self.gacc = 550
@ -22,10 +21,7 @@ function Entity:initPhysics(world, type, x, y, w, h)
self.grav = 0
self.frc = 0
self.x = x or 0
self.y = y or 0
self.w = w or 16
self.h = h or 16
self:initHitbox(x, y, w, h)
self.onGround = false
self.playerID = -1
@ -33,25 +29,10 @@ function Entity:initPhysics(world, type, x, y, w, h)
self:register()
end
function Entity:setDebugColor(r,g,b)
self.debug = {}
self.debug.r = r
self.debug.g = r
self.debug.b = r
end
function Entity:update(dt)
end
function Entity:register()
self.world:registerActor(self)
end
function Entity:destroy()
self.world:removeActor(self)
end
function Entity:canBounce(bounce)
self.bounce = bounce
end
@ -99,21 +80,10 @@ function Entity:changeSpeedToCollisionNormal(nx, ny)
self.xsp, self.ysp = xsp, ysp
end
function Entity:getCenter()
return self.x + self.w / 2,
self.y + self.h / 2
end
function Entity:purge()
self:remove()
end
function Entity:setFilter()
self.filter = function(item, other)
return nil
end
end
function Entity:checkGround(ny)
if not (self.grav == 0) then
if ny < 0 then self.onGround = true end