-
-
Save damian-pastorini/d3175827233883f77ef33c585842debf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.p2world.on('impact', function(evt){ | |
var bodyA = evt.bodyA, | |
bodyB = evt.bodyB; | |
if(bodyA.hasOwnProperty('playerId')){ | |
console.log('bodyA is the player! ', bodyA.playerId); | |
var currentPlayer = this.state.players[client.sessionId]; | |
bodyA.velocity = [0,0]; | |
} else { | |
if(bodyB.hasOwnProperty('playerId')){ | |
console.log('bodyB is the player! ', bodyB.playerId); | |
var currentPlayer = this.state.players[client.sessionId]; | |
bodyB.velocity = [0,0]; | |
} else { | |
console.log('who the fuck is moving???'); | |
} | |
} | |
console.log('bodies position: ', bodyA.position, bodyB.position); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment