Jump to content

how to have a beautiful shake effect with gyro.js and physics ?


Recommended Posts


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 :


		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;
		gyro.frequency = 10;
			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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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