Jump to content

Overlap sets touching properties - correct behavior or bug?


Recommended Posts

Hi guys,


Do you think that it's correct that calling game.physics.overlap sets the touching properties of the sprites involved?


I think this is a bug, because I think the overlap function should perform checks only and not alter properties of the sprites involved.




I was using overlap to enable the player to gather coins.

So I overlap the player sprite with the coins sprite group, add a callback in which I kill the coin sprite.


So far so good - but now if the player presses the jump key at exactly the right moment (when gathering a coin) he can jump off of this coin.

Because overlap with the coin sets touching.down on the player sprite to true. (and that is what I check to enable the player to use the jump key)


The flag is set to true, because the overlap-function is using the separation-function internally, with a flag to not actually separate - but this flag does not prohibit the setting of the touching properties.


This workaround is easy:

- call overlap function for coin gathering

- setting all touching flags on the player sprite to false

- now call collision function to get the real touching flags (from the ground for example)



What do you think, is this a bug?


(Tested with the dev phaser 1.1.4.)


Link to comment
Share on other sites

Hi Rich,


I was using "v1.1.4 - Built at: Tue Jan 14 2014 03:31:58".


I have now cloned the newest 1.1.4 from github and ran the build script, but I can't test with that version of phaser, because it won't run.


SAT ist undefined, 1.1.4. Phaser crashes on startup with:

"Uncaught ReferenceError: SAT is not defined phaser.js:38028:26"


Okay, by using the SAT.js found in exmaples/wip I got the lasted 1.1.4 phaser to run.


You are indeed correct, the touching flags are no long set.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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