Sign in to follow this  
Barthandelus

[PHASER] Rendering player (CANVAS)

Recommended Posts

Hi,

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 :

Quote

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

[...]

// Player.
    player = game.add.sprite(100, 450, 'character');
    game.physics.arcade.enable(player);
    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);
    player.animations.play('running');

Phaser example on previous versions :

Quote

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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.