Jump to content

Prob with body.immovable..


Nikow
 Share

Recommended Posts

Hi !

 

I'm trying to make a game with collisions between two sprites, the hero and the earth ( a sphere)..

 

When i'm writting this : 

bgFront = this.game.add.sprite(game.width/2,game.height*1.8,"planeteFront");bgFront.anchor.setTo(0.5,0.5);game.physics.enable(bgFront, Phaser.Physics.ARCADE);bgFront.body.immovable = true;

 My sprite bgFront ( which is my sphere) is falling down...

 

I don't understand why ?

 

Thank you !

 

Edit 1 : i've add bgFront.body.moves = false; my sprite doesn't move now, but the hero passes through ...?

Link to comment
Share on other sites

 My sprite bgFront ( which is my sphere) is falling down...

 

I don't understand why ?

 

 

Gravity? Immovable means another object can't influence it, i.e. another sprite colliding with it. But it will still react to world physics, local forces, etc - unless told not to.

 

Also Arcade Physics has no concepts of spheres (or circles) at all - bear this in mind before you get much further :) You may need to swap to P2.

Link to comment
Share on other sites

Gravity? Immovable means another object can't influence it, i.e. another sprite colliding with it. But it will still react to world physics, local forces, etc - unless told not to.

 

Also Arcade Physics has no concepts of spheres (or circles) at all - bear this in mind before you get much further :) You may need to swap to P2.

 

Thank you ! P2 physics looks like awesome !

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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