Advertisement
Guest User

Untitled

a guest
May 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. local updateMotion = System(
  2. {"position", "velocity"},
  3. function (position, velocity, dt)
  4. local destination = position + velocity * dt
  5. position.x, position.y = destination:unpack()
  6. end
  7. )
  8.  
  9. local destroyOffscreen = System(
  10. {"-destroyOffscreen", "position"},
  11. function (position, camera, entities, i)
  12. local sx = camera:cameraCoords(position:unpack())
  13. if sx < 0 or sx > Const.ScaledWidth then
  14. table.remove(entities, i)
  15. end
  16. end
  17. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement