Vink Posted August 2, 2017 Share Posted August 2, 2017 Hi everyone ! First, you have to know that I am a noob with phaser ! And I'm not very good in english so I'm sorry if it's difficult for you to understand me. So I have a problem with my game. I would like to know if it's possible to move towards the pointer, i saw that there are some examples to move to pointer but I would like the player move towards the pointer but he doesn't stop at the pointer, it's just for the direction. I have also another question : i want to launch something (for exemple a rocket), when you launch something the object accelerate and finally decelerate, so for simulate this, I have to recreate the deceleration or not ? Thanks for your answers and if it's not understandable i can rewrite ^^ ! Link to comment Share on other sites More sharing options...
samid737 Posted August 4, 2017 Share Posted August 4, 2017 q1: One example is to use moveToPointer and vary the speed with the distance: https://codepen.io/Samid737/pen/rzWGzm q2: Basically two things will cause the rocket to decelerate after it is in flight: drag and gravity. You can set both properties in arcade physics. The drag will have to be some function of the rocket speed to simulate trajectories. To add an extra reference, here is a pretty nice rocket model using arcade physics: https://codepen.io/Samid737/pen/YxprER You can tweak the rocket by adding fuel, adjusting thrust etc... You can also add control input (angleToPointer for example). This model does not fully consider flight forces (lift and drag forces), so the rotation of the rocket is not super accurate...If you can live with that then this will be a fine physics model for a simple rocket game. Link to comment Share on other sites More sharing options...
Recommended Posts