modules/world: add basic move functions to entities

This commit is contained in:
Kazhnuz 2019-04-07 18:33:41 +02:00
parent 5ec137416e
commit 262bf97e67
2 changed files with 6 additions and 2 deletions

View file

@ -28,6 +28,10 @@ function Actor2D:update(dt)
-- here will be update actions -- here will be update actions
end end
function Actor2D:move(newx, newy)
self.world:moveActor(self, newx, newy)
end
function Actor2D:draw() function Actor2D:draw()
-- here will be update actions -- here will be update actions
end end

View file

@ -57,8 +57,8 @@ function BaseWorld:removeActor(actor)
end end
function BaseWorld:moveActor(actor, x, y, filter) function BaseWorld:moveActor(actor, x, y, filter)
self.actors[actor].x = x actor.x = x
self.actors[actor].y = y actor.y = y
-- as the baseworld have no collision function, we return empty collision -- as the baseworld have no collision function, we return empty collision
-- datas, but from the same type than bump2D will return -- datas, but from the same type than bump2D will return
return x, y, {}, 0 return x, y, {}, 0