Jump to content

Problem with group physics


lukaMis
 Share

Recommended Posts

Hi

 

I have simple (for experienced Phasers at least) question. I am making simple lunar lander style game to get to know Phaser. So i load rocket image and rocket engine sprite than add them in to group and apply physics on the group. I am doing it like this so i only check collision with ground and rocket (so engine does not trigger collision). But i have problem with this engine of mine. When collision is detected engine keeps falling down. How would i disable that?

 

here is link: http://demo.irokus.si/luka/lunarLanderDemo/

 

and code: http://demo.irokus.si/luka/lunarLanderDemo/js/lunarLander.js

 

 

tnx a bunch

 

have a nice day

Luka

Link to comment
Share on other sites

First change  

game.physics.enable(rocketGroup, Phaser.Physics.ARCADE);

 to  

game.physics.enable(rocket, Phaser.Physics.ARCADE);.

Since you only need physics on the rocket there is no need to enable it on the whole group. 

 

Then try adding 

rocket.addChild(rocketEngine); 

This will make the rocket engine to move along with the rocket

Link to comment
Share on other sites

@j0hnskot  Tnx.

I haven't found addChild in documentation and after you suggested it i found somewhere that it is from Pixi engine. Is this the way to go or something that should be avoided and used as a workaround?

 

Luka

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...