Flawless Ship Control Code Without Arcade or P2JS Physics

Article by Richard Davey. Posted on 25th Feb 2015.   @phaser_

Then one day there was an Asteroids machine. It took me 15 minutes to beg for the quarter and 15 seconds to play and die. I was hooked.

"If you use Arcade Physics in Phaser to move a ship you might have noticed it’s not great. It does the trick when you want to code something really quickly like the ship in my DOM control post but for precise control and feel you must do something else."

"P2JS is much better with it’s thrust() function and I did in fact use P2JS’ thurst() for an asteroids game I wrote for the Wii U. It worked great and if you end up using P2JS for collision detection you might as well use what you have."

image

"So why then write it from scratch? For me there are two reasons. Complete control of all the ship dynamics and the most important speed. The speed on mobile devices is what I’m really taking about and if you stay away from physics calculations your game will be faster."

Read the full tutorial