How do I make a "save position" in a infinite runner?

Get help using Construct 2

Post » Thu Mar 31, 2016 6:28 pm

Hello, my friends. I'm making an infinite runner game, like Temple Run, but in 2D. By example:

az648995.vo.msecnd.net/devices/2015/01/Temple-Run.jpg

I'm trying to make a "save position" system, where the player spends an item to save the position where did he died, and then restart from that position, like a check point, but in any place of the platform.

The game is using some pre-build platforms - that are tilesets - , and then it picks one at random, and when the player touches the trigger, it puts one in sequence of the one that is already running. Like this:

drive.google.com/file/d/0BzI4Lq7yvoVMWWVpbEloME80Uzg/view

An example of pre-build platform: drive.google.com/file/d/0BzI4Lq7yvoVMb183OFZzazB6VzA/view

My problem is: how can I make the game know in what platform the character died? I can save its coordinates in a variable, but how can I make the game know what platform it has to build, in order to the character spawn in the nearest place? I've tried to use the "Save Game" action, and it indeed worked, the problem is that when I use the "Load Game", the character end up spawning in the same trigger that made him die, a.k.a. "a hole", and the game can't proceed. I've tried to save the UID of the platform that is running, but I don't know how, or if it's possible to create an object only according to it's UID.

I'm struggling in here, since I don't want to use "tricks", like creating a checkpoint in front of every hole, and make the check of which one was the last.

Can anyone help me? Thank you, guys ^^

Sorry by the URLs, it isn't accepting imgur links to set an image.
Riding the Rainbow for all the eternity
B
10
S
5
Posts: 31
Reputation: 934

Post » Mon Apr 04, 2016 3:10 pm

You need to use layered Ids. Have each build platform have an Id, and have a specific location (x,y) on the build platform that is stored as the 'spawn' location, then just save the platform id of where the player died at.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed Apr 06, 2016 4:08 pm

gumshoe2029 wrote:You need to use layered Ids. Have each build platform have an Id, and have a specific location (x,y) on the build platform that is stored as the 'spawn' location, then just save the platform id of where the player died at.


Sorry, bro, but how do I create a layered Id, and how do I make to spawn the object according to its Id?
Riding the Rainbow for all the eternity
B
10
S
5
Posts: 31
Reputation: 934

Post » Sat Apr 09, 2016 12:10 am

Like assign an overarching ID number to each section (idk if you levels are layouts or not). Then have a local variable for each section that specifies an x & y coordinate to spawn at. You can use instance variables, local variables, or global variables for IDs. Probably instance variables per tileset would be good.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Sat Apr 09, 2016 2:15 pm

gumshoe2029 wrote:Like assign an overarching ID number to each section (idk if you levels are layouts or not). Then have a local variable for each section that specifies an x & y coordinate to spawn at. You can use instance variables, local variables, or global variables for IDs. Probably instance variables per tileset would be good.


Uhm... I got it. I made a sprite called "zone", and according to their UID, if the players dies, it will toggle a boolean instance variable - by the way, a clever solution you've found, thank you :D -, but i'm using some tilesets that are randomly spawned to make the level. There is a way that I can make construct create an object - in case, the specific tileset where the player died - according to its UID or a variable?
Riding the Rainbow for all the eternity
B
10
S
5
Posts: 31
Reputation: 934

Post » Thu Apr 21, 2016 4:02 pm

Yea, that is usually how most of my complex problems are solved... by side-stepping the problem, lol.

And yes, you can, you just have to have an object for remembering the UID. Like a global var or something. Something like var lastDiedLocUID = X.

Sorry for the late reply, my life became extremely busy the last few weeks.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824


Return to How do I....?

Who is online

Users browsing this forum: Lancifer, MPPlantOfficial, Sup with that? and 60 guests