1 decade ago by Harley
Hello all,
I have an issue where I'm trying to trigger an entity to move a certain distance, but I want to be able to set it's speed.
So for example I want it to move 300 pixels up at a speed of '10'. In an alternative scenario I want it to move 300 pixels up at a speed of '5'. I don't want to have to update it's position manually on every entity update() call - I just want to set it in motion and for the game update() to take care of it's movement until it reaches it's distance.
Currently I'm trying to do this with the vel.y. However because there is no distance component to velocity, if I lower the velocity it just moves less distance.
I'm sure I'm probably just overlooking a simple solution to this, but it would be great to get some help on this one.
Thanks,
Harley
I have an issue where I'm trying to trigger an entity to move a certain distance, but I want to be able to set it's speed.
So for example I want it to move 300 pixels up at a speed of '10'. In an alternative scenario I want it to move 300 pixels up at a speed of '5'. I don't want to have to update it's position manually on every entity update() call - I just want to set it in motion and for the game update() to take care of it's movement until it reaches it's distance.
Currently I'm trying to do this with the vel.y. However because there is no distance component to velocity, if I lower the velocity it just moves less distance.
I'm sure I'm probably just overlooking a simple solution to this, but it would be great to get some help on this one.
Thanks,
Harley