Save where player died

Get help using Construct 2

Post » Wed Jun 12, 2013 9:03 pm

hey guys is there way save where player died than when level is done show player it with dots or something else
Image
B
49
S
20
G
39
Posts: 445
Reputation: 22,991

Post » Wed Jun 12, 2013 10:21 pm

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.
ArcadEd2013-06-12 22:21:39
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,497

Post » Thu Jun 13, 2013 2:21 am

@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
Image
B
49
S
20
G
39
Posts: 445
Reputation: 22,991

Post » Thu Jun 13, 2013 5:22 am

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!

When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
33
S
13
G
8
Posts: 316
Reputation: 7,641

Post » Thu Jun 13, 2013 5:45 am

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.
B
100
S
36
G
16
Posts: 947
Reputation: 16,219


Return to How do I....?

Who is online

Users browsing this forum: RetroSpock, skrotar and 8 guests