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

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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.