mirror of
https://github.com/wassname/phaser.git
synced 2026-08-18 12:20:33 +08:00
And we have level/ground jitter fixed :) Starstruck is running again properly now too. Time to commit and remove lots of debug data.
This commit is contained in:
@@ -25,6 +25,17 @@ var bg;
|
||||
|
||||
function create() {
|
||||
|
||||
$('#step').click(function(){
|
||||
console.log('---- STEP', game.stepCount, '-------------------------------');
|
||||
game.step();
|
||||
});
|
||||
|
||||
$('#start').click(function(){
|
||||
console.log('---- START DEBUGGING -------------------------------');
|
||||
game.enableStep();
|
||||
player.debug = true;
|
||||
});
|
||||
|
||||
game.stage.backgroundColor = '#000000';
|
||||
|
||||
bg = game.add.tileSprite(0, 0, 800, 600, 'background');
|
||||
@@ -43,12 +54,14 @@ function create() {
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
game.physics.gravity.y = 260;
|
||||
game.physics.gravity.y = 250;
|
||||
game.physics.setBoundsToWorld();
|
||||
|
||||
player = game.add.sprite(32, 32, 'dude');
|
||||
player.body.bounce.y = 0.2;
|
||||
player.body.minVelocity.y = 5;
|
||||
player.body.collideWorldBounds = true;
|
||||
player.body.setSize(16, 32, 8, 16);
|
||||
player.body.setRectangle(16, 32, 8, 16);
|
||||
|
||||
player.animations.add('left', [0, 1, 2, 3], 10, true);
|
||||
player.animations.add('turn', [4], 20, true);
|
||||
@@ -106,8 +119,10 @@ function update() {
|
||||
}
|
||||
}
|
||||
|
||||
if (jumpButton.isDown && player.body.touching.down && game.time.now > jumpTimer)
|
||||
// if (jumpButton.isDown && player.body.touching.down && game.time.now > jumpTimer)
|
||||
if (jumpButton.isDown && player.body.onFloor() && game.time.now > jumpTimer)
|
||||
{
|
||||
console.log('jump');
|
||||
player.body.velocity.y = -250;
|
||||
jumpTimer = game.time.now + 750;
|
||||
}
|
||||
@@ -116,6 +131,7 @@ function update() {
|
||||
|
||||
function render () {
|
||||
|
||||
// game.debug.renderSpriteBody(player);
|
||||
game.debug.renderPhysicsBody(player.body);
|
||||
game.debug.renderBodyInfo(player, 16, 24);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user