enriqueto Posted March 20, 2014 Share Posted March 20, 2014 I've done a prototype of a pachinko game and collisions doesn't behave as expected (just click on the screen): https://dl.dropboxusercontent.com/u/17484152/PachinkoPrototype/index.html and that's the code:module PachinkoPrototype { export class PachinkoScene extends Phaser.State { public static s_currentPachinkoScene:PachinkoScene ; create() { PachinkoScene.s_currentPachinkoScene = this; this.game.physics.startSystem(Phaser.Physics.P2JS); this.game.physics.p2.gravity.y = 500; this.game.physics.p2.defaultRestitution = 2; this.game.input.onDown.add(this.launch, this); for (var i = 0; i<5; i++){ for (var j= 0; j< 5; j++){ var deltaX = j%2 == 0 ? 150:90; var pivot = this.add.sprite(deltaX + i *120 ,200 + j *120, 'pivot'); this.game.physics.p2.enable(pivot, false); pivot.body.setCircle(20); pivot.body.data.motionState = 2; } } } launch(){ var ball = this.add.sprite(300,50, 'ball'); this.game.physics.p2.enable(ball, false); ball.body.setCircle(36); ball.body.bounce = new Phaser.Point(4,4); } }}any advice? Link to comment Share on other sites More sharing options...
rich Posted March 20, 2014 Share Posted March 20, 2014 Can you enable the debug for all objects and re-upload it please. Would like to see what's actually going on. Link to comment Share on other sites More sharing options...
enriqueto Posted March 20, 2014 Author Share Posted March 20, 2014 done! Link to comment Share on other sites More sharing options...
enriqueto Posted March 24, 2014 Author Share Posted March 24, 2014 is there anything to be done? Link to comment Share on other sites More sharing options...
rich Posted March 24, 2014 Share Posted March 24, 2014 It looks ok to me - it just doesn't look anything like pachinko You should create a Contact Material that has the sort of properties you want the pegs and ball to exhibit. Then apply the contact material to your pegs and tweak until it feels correct. There is an example showing how to make contact materials that you can copy to get started with. I reckon that is probably all it needs. Link to comment Share on other sites More sharing options...
enriqueto Posted March 27, 2014 Author Share Posted March 27, 2014 Thanks Rich, after some tweaks the prototype works alright. Link to comment Share on other sites More sharing options...
Recommended Posts