Jump to content

Phaser 2.5 Sprite reset


deleteme
 Share

Recommended Posts

Hey all! I'm having an issue where i'm trying to reset the player sprite, but it doesn't do anything,

and the console yields no errors and i know i'm trying to reset the right thing. I recently grabbed a copy of Phaser 2.5,

and yet if i switch back to the older phaser i was using (2.4.4) the reset i have works correctly. I'm a little stumped on what I'm missing here,

any help would be appreciated!

Link to comment
Share on other sites

So I'm creating my player object and setting up some animations for him

player = game.add.sprite(-40, game.world.height - 97, "DoomGuy");
    player.animations.add("walk");
    player.animations.play("walk", 4, true);
    player.anchor.setTo(0.5, 0.6);
    player.scale.setTo(0.7, 0.7);
    game.camera.follow(player);
    
    game.physics.arcade.enable(player);
    player.body.gravity.y = 680;
    player.body.collideWorldBounds = true;

 

then later on say when the player is killed by an enemy or completes the level i want him to reset back to spawn and kill him so that i can display a score

and i do this with thise line

player.reset().kill();

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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