Moving Objects like asteriods

I am trying to make a asteroid field that moves across the game. I looked in the script reference file and it had something about waypoints. I have no clue what its talking about. Could some explain how waypoints work or how to move objects without an AI.



  • Waypoints have nothing to do with moving objects. Waypoints are what relay can place in the world.

    If you want to move asteroids around, the only way would be to update the position each frame.
    function init()
      asteroid = Asteroid()
      asteroid:setPosition(100, 100)
      asteroid.speed = 50
    function update(delta)
      local x, y = asteroid:getPosition()
      asteroid:setPosition(x + asteroid.speed * delta, y)
    Naturally, it becomes more complex if you have many asteroids and if you want more complex movements.
  • Thank you so much that is exactly what i am looking for
Sign In or Register to comment.