Hi!
I'm making a platformer game where, when the player collides with a object called "fish", the fish object will set its own instance variable called "collected" to 1.
Then, at some point in the game, each fish object that has the variable collected set to 1, will be "saved" into a file with the help of a loop.
The file will look like this:
...
fishCollectedUID:8
fishCollectedUID:9
fishCollectedUID:10
fishCollectedUID:11
...
If you ever exit the level to the Menu, and then chose to continue, I need to somehow make a loop that can find each new line with the word "fishCollectedUID:" and use the number written after to set each fish on layout to invisible with that UID.
I know to use regular expressions, and I have no problem writing a expression to find the word "fishCollectedUID:" and the number. But I'm having trouble writing a loop that would go to the next line, after the one above has already been checked.
Also, the number of fishes collected are unknown, since the player picks them up as he/she pleases, before going back to menu.
For your knowledge, I also store the files content in a global variable, so I can check that with a regular expression like this: regexMatchAt(gameSaveInfo,...)
Is it possible to do in Construct 2? Would someone be able to show me an example of how I could do this?
Hopefully I'm clear enough with what I mean, and if I'm not, ask I'll try to be more specific.