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!

Share this post


Link to post
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();

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

  • Recently Browsing   0 members

    No registered users viewing this page.