0 Favourites

Save where player died

  • hey guys is there way save where player died than when level is done show player it with dots or something else

  • Sure, create some global variables like deadX and deadY. When the player dies, set deadX to player.x and deadY to player.y

    Or if you need to save more than one location, use an array.

  • ArcadEd

    thanks for the reply but I have known it can be done with array I asked for example or tutorial I m realy noob :D anyway I dont need it anymore but if there is an example for it can be usefull

  • Another simpler way is ...create a new sprite (your dot!)or spawn it at the player location when they register the death ..

    then destroy the player. but the dot sprite will remain on your layout where you left it..(at the players death spot)

    Then if you wanted you can respawn the player at the dot, next to it or whatnot ..you would need to keep track of how many times the player dies as well...so that you only respawn at the most recent death spot...if that is what you want...

    You would need a player object and a Death Dot object and your level layout of course..

    So it would look like this on your sheet..in pseudo code

    <condition> Player health = 0 (or Player(variable = dead))

    <actions>->> "Player" spawn another object "Death Dot" at player origin

    ->> Player set death animation

    ->>wait until animation complete

    ->> Player Destroy

    ->> Wait (any amount of time you like)

    ->> System>create object"Player at "Death Dot" origin

    optional ->> "Death Dot" ->> destroy

    Does that make sense?

    if you go slow....Break down EVERY action you want to see into EACH separate action...Computers work like this..One event at a time very fast...stacked up in logical sequence ..the computer/program will follow exactly what you tell it to do ..as long as you put your orders in the right order ..the computer will execute those orders exactly as you wrote them..so it something doesnt work...it because you didnt make your orders simple enough.....one thing at a time....until you get good at it..then you can do fancy stuff...multitask programming..

    dont worry...just go slow....computers may appear complex but really they are just doing one thing at at time REALLY FAST!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I do it slightly differently. I do save the player's X and Y value, but I also store the current layout's name in a global variable. So if health = 0, it stores everything and goes to the gameover layout. If the player wants to continue where they died, it moves you back to that layout and that position.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[plugin] Youtube player
175 20,539
rexrainbow's avatar
Unread hot topic
33 4,135
mirosurabu's avatar
Unread hot topic
44 7,745
Ashley's avatar
Ashley Construct Team Founder