Jump to content

Jump Physics Issue


RielDFC
 Share

Recommended Posts

I'm using identical code to the Phaser tutorial with arcade physics. The only thing really different in this regard is the size of the canvas is 960 x 640 rather than 800x600, but for some reason the gravity (of 300) is MUCH slower and the player.body.velocity.y ( -250) is pretty much not moving the player at all.

player = game.add.sprite(32, 485, 'dude');
	game.physics.arcade.enable(player);
	player.animations.add('right', [5, 6, 7, 8], 10, true);
	player.body.gravity.y = 300;
	player.body.collideWorldBounds = true;
//  Allow the player to jump if they are touching the ground.
	if (cursors.up.isDown && player.body.touching.down)
	{
			player.body.velocity.y = -250;
	};

I can set these so they do move faster and further, but the player.body.velocity.y has to be set to about -25000 to go a little over half way up the screen, and there's no upward jump. the player literally starts at his resting point, appears at the highest jump height and then gravity actually works and slowly falls.

 

Is there something i might be missing here? Any help would be appreciated.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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