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.

Thanks

Comments

  • 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
    end
    
    function update(delta)
      local x, y = asteroid:getPosition()
      asteroid:setPosition(x + asteroid.speed * delta, y)
    end
    
    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.