blackgames Posted March 23, 2014 Share Posted March 23, 2014 Hi, I have a problem with collision. I have a sprite:zombie = game.add.sprite(100, 100, 'zom');var x = 10;var y = 500zombie.reset(x, y);and a group:pigs = game.add.group();pigs.createMultiple(19, 'pig');var x_fix = 10; var y_fix = 495; with the same position (debuginformation): but the code in update function not worked:game.physics.arcade.overlap(zombie, this.pigs, this.dead, null, this); but the sprites are overlaped: I use phaser 2.0.1 and I also try 2.0.0 I tried to enable physics, add a bigger bounding box, too use two sprites and not an group. Nothing worked for me Please help - I going crazy! ClonkMobile 1 Link to comment Share on other sites More sharing options...
JP91 Posted March 23, 2014 Share Posted March 23, 2014 collision bug? this work for me... game.physics.startSystem(Phaser.Physics.ARCADE); this.player = game.add.sprite(x,y,"nameImage") game.physics.arcade.enable(this.player); this.object = game.add.group(); this.object.createMultiple(5,"nameImage"); game.physics.arcade.enable(this.object,true); //new object function new (){ var any = this.object.getFirstExists(false) if(any){ //some any.x any.y any.reset() } } //UPDATE game.physics.arcade.overlap(this.player,this.object,this.callback,null,this); callback(a,{ //some b.kill(), b.y+=100...etc } blackgames 1 Link to comment Share on other sites More sharing options...
MichaelD Posted March 24, 2014 Share Posted March 24, 2014 Same problem with v2.0, and v2.0.1.JP91 thanks for the info, maybe you could wrap those lines in the "code" format that these forums provide for more readability. Thanks.The code symbol in the WYSIWYG is "<>" Link to comment Share on other sites More sharing options...
JP91 Posted March 24, 2014 Share Posted March 24, 2014 heheheheheh yes,excuse me is that I have javascript disabled but I'll get it Link to comment Share on other sites More sharing options...
rich Posted March 24, 2014 Share Posted March 24, 2014 I would try this against the 2.0.1 build files that I literally uploaded a few minutes ago (remember it's still in dev, so subject to change as much as is needed before release - however overlapping is working fine now and several test cases were made for it) Link to comment Share on other sites More sharing options...
blackgames Posted March 24, 2014 Author Share Posted March 24, 2014 Thanks everybody, this works fine for me:--> Update to the new Version 2.0.1game.physics.startSystem(Phaser.Physics.ARCADE);game.physics.arcade.enable(this.zombie);game.physics.arcade.enable(this.pigs); But the next Problem shows:If I make a tween off the sprites like this...var x_fix = 20;var y_fix = 20;var x_tween = 10;var y_tween = 10;pig.reset(x_tween, y_tween); game.add.tween(pig).to( {x: x_fix, y: y_fix, alpha: 1}, 500, Phaser.Easing.Linear.None).start(); ...the sprites are fly over the whole screen and never stops.... still missing another parameter? I tried immoveable, gravity, allowGravity... Please help again. I firmly hang Link to comment Share on other sites More sharing options...
rich Posted March 24, 2014 Share Posted March 24, 2014 Are you trying to tween a physics enabled sprite? If so try this instead:game.add.tween(sprite.body).to({x: whatever, y: whatever} .... Link to comment Share on other sites More sharing options...
blackgames Posted March 24, 2014 Author Share Posted March 24, 2014 Yes, I dont need physics but I will use the overlap-function I have just tried - the sprites no more "flying" around, but the tween not works. The sprites stops at the reset points. Link to comment Share on other sites More sharing options...
blackgames Posted March 25, 2014 Author Share Posted March 25, 2014 Has anyone else the problem?this is important for me ... otherwise I have to completely rewrite the code Link to comment Share on other sites More sharing options...
rich Posted March 25, 2014 Share Posted March 25, 2014 You don't need to use physics at all if all you're doing is checking for an overlap. Especially if you want to use lots of tweens and the like. Here I've put together 2 examples for you: http://examples.phaser.io/_site/view_full.html?d=sprites&f=overlap+without+physics.js&t=overlap%20without%20physics and http://examples.phaser.io/_site/view_full.html?d=sprites&f=overlap+tween+without+physics.js&t=overlap%20tween%20without%20physics Link to comment Share on other sites More sharing options...
blackgames Posted March 25, 2014 Author Share Posted March 25, 2014 Rich, thank you very much!intersects... oh.. I fixed to much on physics.overlap... You are the best :-) Link to comment Share on other sites More sharing options...
Recommended Posts