Jump to content

spriteBatch not updating body position


nuvorm
 Share

Recommended Posts

Hello,

 

It looks like the spriteBatch group is not updating the body of a sprite correctly.

Is this expected behaviour?

 

 

    this.game.physics.startSystem(Phaser.Physics.ARCADE);

 

    this.gr=this.game.add.spriteBatch();
     
    this.gr.enableBody = true;
    this.gr.physicsBodyType = Phaser.Physics.ARCADE;
    this.s=new Phaser.Sprite(this.game,0,0,'atlas','player_01.png')
    this.gr.add(this.s)
    this.s.fixedToCamera=true
    
and in the state update:
 
   this.s.cameraOffset.x+=1;
   this.game.debug.body(this.s);
 
the body is stuck at 0,0
 
phaser 2.1.0
 
regards, Wouter

 

Link to comment
Share on other sites

If i understand correct:

When a sprite is put on the screen the gpu makes a drawcall.

If you have one texture used by many sprites you can reduce the drawcalls made by the gpu using a spritebatch.

 

I am not sure if a sprite in a spritebatch is allowed to have a body but i guess i can.

 

When using a 'normal' group the body of a sprite is updated, not with a spritebatch (on my side anyway)

Maybe i am doing something wrong.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
 Share

  • Recently Browsing   0 members

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