universaljs Posted April 17, 2016 Share Posted April 17, 2016 Hi, if in "create" function is kladka.body.immovable = true; then in "update" function this not working: game.physics.arcade.overlap(kladki, player, function(){ console.log("x"); },null, this); Is it possible to do that work? more code: [...] function create(){ kladki = game.add.group(); kladki.enableBody = true; var kladka = kladki.create(4*tileSize, 45*tileSize, 'kladka'); game.physics.enable(kladka, Phaser.Physics.ARCADE); kladka.body.collideWorldBounds = true; kladka.body.allowGravity = false; kladka.body.immovable = true; } function update() { game.physics.arcade.collide(kladki, player); game.physics.arcade.collide(kladki, layer); // if in create functions is kladka.body.immovable = true; this not working: game.physics.arcade.overlap(kladki, player, function(){ console.log("x"); },null, this); } [...] Link to comment Share on other sites More sharing options...
rich Posted April 18, 2016 Share Posted April 18, 2016 This ability was added in Phaser 2.4.7, but any version before that (including the current stable one) doesn't provide overlap or collide checks for two immovable bodies. Link to comment Share on other sites More sharing options...
universaljs Posted April 18, 2016 Author Share Posted April 18, 2016 Ok, thx! but when strapped version 2.4.7 - still dos't detect a collision (physically collision works but I need callback function at the time of the collision)... When there are 2 objects to the set collisions, then at the moment when one object is enabled gravitation (player.body.allowGravity = true;) and the other has disabled gravitation (kladka.body.allowGravity = false;) at a time when the player will jump on this object - a gravity player turns gravity on the object "Kladka" ... is it possible to block it? I tried the following: kladka.body.immovable = true; - but then there is a problem, which I described earlier ... I need detect a collision there (I need a callback function) ... like this: game.physics.arcade.overlap(kladki, player, function(){ // callback },null, this); Do you have any idea? Link to comment Share on other sites More sharing options...
rich Posted April 18, 2016 Share Posted April 18, 2016 What is your code doing differently to this example? because the callbacks are working fine here (in 2.4.6 and 2.4.7) http://phaser.io/examples/v2/arcade-physics/bounding-box Link to comment Share on other sites More sharing options...
universaljs Posted April 18, 2016 Author Share Posted April 18, 2016 I thought that this can only use game.physics.arcade.overlap. Now it works, great! Thanks! I see that version 2.4.7 is for me much better camera work - stable ... I think now will stay with her ... Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts