Jump to content

[PHASER] Rendering player (CANVAS)


Recommended Posts


I'm a actually making a game using PHASER. On this game, player have to jump to escape balls rolling on the ground, like on an infinite runner. Actually, everything is working fine but the player is showed using a spritesheet divided on 128*128 resolution. The character animation running doesn't use 128 pixels on width causing the ball to collide with the player even if the player doesn't hit the ball. The player hitbox is actually configured to 128*128 but I know that in previous versions of PHASER, it was possible to render player to make his hitbox scale his skin.

I didn't find this function in the actual version of PHASER. Can someone help ?

Thanx in advance.

For information :


game.load.spritesheet('character', './ressources/characterRunning.gif', 128, 128);


// Player.
    player = game.add.sprite(100, 450, 'character');
    player.scale.setTo(0.75, 0.75);
    player.body.gravity.y = 2000;
    player.body.collideWorldBounds = true;
    player.animations.add('running', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 10, true);
    player.animations.add('jump', [2], 10, true);

Phaser example on previous versions :


gameState.main.prototype = { ... render: function() { this.game.debug.renderPhysicsBody(this.bird.body); } };


Link to comment
Share on other sites


  • Recently Browsing   0 members

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