Gabahulk Posted April 30, 2014 Share Posted April 30, 2014 Hello!I´m newbie in Phaser and game programming, And I want to make a open air artillery game. I want the characters to have a up and down movement as if it they were levitating and I was wondering what was the best way to do it with P2 since it will be a artillery game and i'd like to see the characters react to the physical impact of projectiles while levitating.Sorry for any misuse of english (not my native language) and thanks! Link to comment Share on other sites More sharing options...
CtlAltDel Posted April 30, 2014 Share Posted April 30, 2014 You could probably do that by adding thrust against the gravity to the characters. See the thrust example. Gabahulk 1 Link to comment Share on other sites More sharing options...
Gabahulk Posted May 1, 2014 Author Share Posted May 1, 2014 Thanks! Link to comment Share on other sites More sharing options...
jpdev Posted May 1, 2014 Share Posted May 1, 2014 I think it would be a better idea to disable global gravity and then enable gravity only on the things you need it on. (projectiles and stuff like that) https://github.com/schteppe/p2.js/wiki#gravity Got the from the ps2.js wiki I must admit that I am not 100% sure where to put this in a phaser use-case of p2. Gabahulk 1 Link to comment Share on other sites More sharing options...
Gabahulk Posted May 7, 2014 Author Share Posted May 7, 2014 Thank you for the reply jpdev, but I'm afraid that by doing what you sugested there would be no up and down movement wouldn't it? As for CtrlAltDel's answer , if any character got hit it would recieve rotation, by using thrust it would move to another direction or the force is applied relative to the initial position ?Thanks! Link to comment Share on other sites More sharing options...
CtlAltDel Posted May 7, 2014 Share Posted May 7, 2014 You can disable rotation on your body to keep it upright that would solve that problem. Gabahulk 1 Link to comment Share on other sites More sharing options...
Recommended Posts