Jump to content

P2 Body still in motion after killing and reviving


Lyian
 Share

Recommended Posts

Dear Community,

 

I honestly have no idea what I am doing wrong. 
Actually I shoot a ball towards a sensor, which kills the ball and reviving it via reset function.

But sometimes if i hit the borders near the sensor, which let the ball bounce off towards the sensor, sometimes the physics will be applyied after reviving it.

 

White.prototype.update = function() { 	if (this.foul){        console.log(placeIndex);		this.body.data.shapes[0].sensor = true;				this.body.onBeginContact.add(this.enter);		this.body.onEndContact.add(this.leave);								if(this.game.input.activePointer.isDown){		       placeIndex = placeIndex.filter(function(n){ return n != undefined }); 	               placeIndex = placeIndex.filter(Boolean);        		if (placeIndex.length == 0){					 	placeNumber = 0;		 	placeIndex  = [];                        this.foul = false;		}							}	}else{        this.body.data.shapes[0].sensor = false;    }   },White.prototype.test = function(){	    this.kill();	    this.body.velocity.x = 0;       this.body.velocity.y = 0;       this.reset(300,300);      this.move();		}White.prototype.move = function(){	this.foul = true;}

I actually want to avoid that the ball has any physics applied to it after bouncing into the sensor after reviving it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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