[Arcade] body / velocity messed up by update to new Phaser version

Recommended Posts

I just upgraded to Phaser 2.9.3, since then I get a strange behavior.

1. I press Left / Right to change the Sprite's velocity (x). // See update method
2. Sprite has enabled Physics, World.gravity is 2000 // See in create method
3. But the Sprite instead of moving left (negative velocity.x) moves upwards // See attached gif

What I figured out till yet:
- velocity.y turn to NaN by colliding with a collisionGroup .
- velocity.y stays NaN, even if the character moves into the air. (whyever it moves into air..)

There is nothing else going on.
I tested this as a test-case, not inside my game, to be sure I'm not messing something up.

create method:

super(state.game, x, y, 'minions');
this.level = state;
this.body.setSize(45, 110, 80, 45)

update method:

if(this.controls.on("left")) {
  this.body.velocity.x = -500;
} else if(this.controls.on("right")) {
  this.body.velocity.x = 500;

Anyone have a clue why this happens?

Thanks in advance.


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.