Will Posted December 31, 2013 Share Posted December 31, 2013 Is this possible? In my logic, I want to know when a sprite and a group are not colliding. Also, is it possible to keep physics collisions working in a background tab? Cheers Link to comment Share on other sites More sharing options...
glass22 Posted December 31, 2013 Share Posted December 31, 2013 function doesOverLay(unitOne, unitTwo){ var left = unitOne.x; var right = unitOne.x + unitOne.width; var top = unitOne.y; var bottom = unitOne.y + unitOne.height; if(left > unitTwo.x && right < unitTwo.x + unitTwo.width) { if(top > unitTwo.y && bottom < unitTwo.y + unitTwo.height) { return true; }else{ return false; } }else{ return false; } } that will do manually, would ! work with the !game.physics.overlap(Player, coins) I'm not sure if a return value is sent? Link to comment Share on other sites More sharing options...
Alvin Posted December 31, 2013 Share Posted December 31, 2013 Hi,I'm not sure if this is what you are looking for, but you can simply set a boolean and change if when the group collide so you'll know when they are not according to its value, like this :if(game.physics.overlap(Player, coins)){ // or in your game.physics.overlap/collide callback colliding = true;}Then when colliding is set to false, they are not overlapping/colliding Arlefreak 1 Link to comment Share on other sites More sharing options...
Will Posted December 31, 2013 Author Share Posted December 31, 2013 Ok, thanks guys. Gonna have a play and see if I can get it to work... Any idea how to keep the physics collision stuff still working when the tab does not have focus? My sprites still move (I want them to) but no longer collide if I switch tab. Link to comment Share on other sites More sharing options...
rich Posted December 31, 2013 Share Posted December 31, 2013 Disable the visibility check in Phaser.Stage. Link to comment Share on other sites More sharing options...
Will Posted December 31, 2013 Author Share Posted December 31, 2013 Disable the visibility check in Phaser.Stage. I have done that :| It works fine when the chrome window does not have focus, just not when I am in another tab. Anything to do with how Chrome slows down updates in background tabs? Link to comment Share on other sites More sharing options...
Recommended Posts