I wrote a method that creates a new button and it shows at the starting city as intended. However, I would like that button to move to the destination city on a world map, showing how far it traveled to it’s destination. I don’t know how to do that. Below is the code I have so far ( have the starting and destination coordinates stored in global variables):
If I’m understanding correctly, you want the button to spawn at one city, then move to the new city over time.
If this is the case, you can either tween it, or you can add a sccript to the button that has a _process() function that updates it over time until it reaches its destination.
Understood. If I use the tween method, is it possible to increase the duration temporarily mid-movement? I may want to simulate wind resistance, “slowing down” the speed of the airship.
What you’d have to do is declare the tween variable as a class-scoped variable. Then if you had wind resistance you’d have to delete the tween, create a new one, then when the wind is gone, do the same thing again.
If you just put the velocity in a _process() function, you could just have a wind resistance variable as part of the equation all the time and just change it for however long you wanted to.