modules/world: add basic move functions to entities
This commit is contained in:
parent
5ec137416e
commit
262bf97e67
2 changed files with 6 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue