bexphones Posted December 6, 2018 Share Posted December 6, 2018 Hi, I would like shake my phone to see my objects collide to the bounds of my phone. i success but the effect doesn't look great. I must rotate my phone to see this effect. What i want is only shake my phone and obtain the same result. What must i do to have this ? Thanks. here my snippet : game.world.setBounds(0,0,1400,1750) o.lot_of_roll = game.add.spriteBatch(); var stars = []; for (var i = 0; i < data.number_rolls_players; i++){ o.rolls = game.add.sprite(random(200,w-550),random(400,h),'roll_rank') game.physics.enable( [ o.rolls ], Phaser.Physics.ARCADE); o.rolls.body.collideWorldBounds = true; o.rolls.body.bounce.y = 0.8; o.rolls.body.gravity.y = 900; o.rolls.body.allowGravity = true; o.lot_of_roll.addChild(o.rolls); stars.push(o.rolls); } gyro.frequency = 10; gyro.startTracking(function(trac){ for (var i = 0; i < data.number_rolls_players; i++){ o.lot_of_roll.children[i].body.velocity.x += trac.gamma*10; o.lot_of_roll.children[i].body.velocity.y += trac.beta*10; } }); Link to comment Share on other sites More sharing options...
Recommended Posts