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

0 favourites
  • 6 posts
From the Asset Store
A procedurally generated infinite runner in 3D for Construct 3!
  • 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.

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

  • 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?

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 -, 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?

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

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