How do I save randomized object created layout and load

Get help using Construct 2

Post » Mon Apr 28, 2014 9:47 am

Hello ladies and gents;

first of all thanks to Scirra for this awesome tool. I have been playing with Construct but i am stuck on something. I am creating random numbered objects on the layout and when you click one of them it takes you to another layout with randomly created 1- 5 objects than when you click those objects game will take you to the appropriate style of gameplay. Here is my problem when layout is randomized i want the system to remember those created objects when they are created on the 1st time. With my game its generating its content everytime i click the object. I have managed to save the 1st layout by system save mechanic it is remembering the state but if i want to move to other layout it does not save with the same mechanic.

in example: I am a whale in a sea and i want to be able to move to fish nodes in the ocean i see those nodes and click those nodes than i want to see mini nodes in those big zones and click those to play some different hunting game to fill my belly.After that i check ocean and back to the same location every node locations are changed and i dont want it :)

ps. I am not a native english speaker. I am sorry if i made some mistakes. Thank you for your help .
B
8
S
1
Posts: 8
Reputation: 820

Post » Mon Apr 28, 2014 9:54 am

Try to see if the persist behaviour doesn't solve the problem for you, you just put that on all the objects you create?
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Mon Apr 28, 2014 11:50 am

Thank you Nimos.It didnt work exactly because everytime the layout is loaded it randomly generates the nodes so persist function didnt work.I think i need to assign a global variable not to do the randomizing if certain conditions met to be able to use persist. But i was wondering if there is a way to make system create new layouts by itself like roguelikes. Or is it one layout lots of randomization .
What i ment is creating lvls infinitely like lemmings game without creating each level one by one ?

btw Dragonhelm looks awesome.
B
8
S
1
Posts: 8
Reputation: 820

Post » Mon Apr 28, 2014 12:12 pm

I am thinking of spawning a sprite on random created map that will make the system to save with that objects uid so loading the same node will be done with that uid ?
B
8
S
1
Posts: 8
Reputation: 820

Post » Mon Apr 28, 2014 12:17 pm

Thanks alot Nimos persist works with the project. But i was wondering if there is a way to make system create new layouts by itself like roguelikes. Or is it one layout lots of randomization .
What i ment is creating lvls infinitely like lemmings game without creating each level one by one ?

btw Dragonhelm looks awesome.

Thanks a lot :)

You cant make it create new layouts for you, what you would do is like I have done with my dungeon generator if you tried it?
It uses the same layout for creating the different dungeons, so it just resets the layout each time it does, So you would have to make something similar just working for your needs.

I guess that you see the game from the side, since you mentioned lemmings?

If you use tilemaps, I guess you could just make it start in the bottom and just go row by row and put in tiles so you would end up with a landscape.

Image

You would ofc have to set up some rules so it doesn't create tiles in mid air and so on. But then when you want to make a new map, you just erase the old one, which can be done with one action. And you can just make the tiles quite small so it looks more smooth when they walk around it. And you can probably optimize it so the tilemap only covers some of the map and the rest are just background.

So it would look something like this, ofc you wouldn't be able to see the difference it in the actual game :D
Image

If you don't use tilemap you can create environment objects that you just randomly spawn on the map and setup rules for how they should spawn as well. And as with the tilemap when you need to make a new one you simply destroy all of them and do it over.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828


Return to How do I....?

Who is online

Users browsing this forum: alextro, ivanski1983 and 9 guests