Kupo = Entity:New(x,y) function Kupo:New(x,y) local o = Entity:New(x,y) o.pos = {x = x, y = y} o.speed = 20 o.range = 1000 setmetatable(o, self) self.__index = self return o end function Kupo:DoInput() end function Kupo:HandleAnimation() -- flip sprite to look in the direction is moving if self.vel.x ~= 0 then self.flip.x = math.sign(self.vel.x) end self:LoadAnimation(animation.kupo.body) end function Kupo:DoPhysics() -- horizontal collisions if not isThereAnyCollisionAt(self.pos.x + self.vel.x, self.pos.y) then self.pos.x = self.pos.x + self.vel.x end if not isThereAnyCollisionAt(self.pos.x, self.pos.y + self.vel.y) then self.pos.y = self.pos.y + self.vel.y end end