Trouble bringing player "back to life"

0 favourites
  • 12 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello all!

    Having an issue bringing my player "back to life" after it is destroyed by enemy... I will start from the beginning... I'm making a platform game... Box sprite with the platform behavior, pinned to a graphic sprite of my design... Wasn't too hard getting that to work at all... Kudos to Scirra... Anyway here's the issue; I have a health variable(a hybrid design by yours truly and another person from the forum; can't remember the name <img src="smileys/smiley13.gif" border="0" align="middle" />) and the code looks like this:


    System;Every Tick


    System;HeroHealth <1


    Health bar = Set animation to empty

    Hero Box = Destroy

    Player Sprite = Set animation to defeated (playing from the beginning)

    Player Sprite = Set Y to (Blah,Blah)

    System = Wait for 4.0 sec

    Player Sprite = Flash for 2.0 sec

    Player Sprite = Destroy

    System = Subtract 1 from PlayerLives

    Then I have a subevent attached for "disabling the keyboard" for the defeated animation... It's a triggered event BTW...

    I started another string under that event:

    (Triggered event) Player Sprite; On Destroyed

    System = Restart Layout

    System = Create object: Hero Box on layer 1; 83,390

    So as you can tell, I'm pretty much lost at this point... lol! Nothing operates(after my player "dies"... sorry had to update that)the way I thought it would so I didn't bother going any further until I get some feedback... I f anyone has a clue of what I need to do in order to get my player's "2nd chance" to work properly, I'm all ears...

  • Do you have a CAPX ? As I think I may be able to help.

  • Did you reposition the player images an re pi it to the respawned herobox ? Check that first..from the sounds of what you wrote you didnt do you can't see where your player images are...hope that helps...

  • Is herohealth a global variable? If so, on restarting the layout it will still be less than one if you don't reset it first.

  • mystazsea

    Sorry it took so long to reply; Had to work today... And yes sir, I did try the respawn player sprite with pin and still had "weird" results... I may have had the actions in the wrong places; not sure so I will give that another try...


    I did not try that... I will give that a go as well... Appreciate the replies guys!

  • LittleStain

    I just had a thought: If I reset the Global variables, I run into another issue... I don't want my "Player Score" "Player Lives" GV(s) being affected by the reset... There has to be a way to perform this task without resetting the GV(s), or resetting the layout and still subtract from "Player Lives" => respawn player sprite+player box with health full...

  • you only have to set the value of the health variable to what it should be after destroying player and before restarting layout.

  • LittleStain

    .... "Well I feel like a genius... lol!" I had the Player Box and Player Sprite on the WRONG LAYER LOL!!! Thanks for the reply dude...

  • LittleStain

    Ok I'm running into another issue... Things seem to working, but as I'm moving left in the game, my player sprite "has a duplicate" attached to it... So it looks as if I have "two" player sprites just overlapping one another... I'm not sure how I can fix this; also the score "doubles" on the layout reset... I think I can fix this with events so I'll try some combinations I thought of recently..

  • Well I seem to have remedied the Score duplicating it self by re-arranging some for the code... I think I'm good on that aspect, but the player sprite has a "copy" attached in the browser when the layout restarts... I have the hero box re-pinned to the player sprite(both objects have been "respawned" by the system Create event) so I'm not sure how to troubleshoot this problem... Hoping for a little help or insight on this... Thank you.

  • Is it possible you are using a container for the player and hero box? if so you only have to spawn one to get both.. spawning both will create duplicates.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • LittleStain

    OH..... I see... Hence setting container in the first place... Got it! Thank you sir, appreciate the reply :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)