Maintain Level Progress

Just started using Construct 2? Post your questions here

Post » Thu Apr 16, 2015 12:41 pm

What is the basic concept for maintaining progress on levels in a game so that when returning to the game you can continue from where you left off?

Do global variables and web storage provide the answer to this when running the game on Android?

Hoping someone can point me in the right direction for a good read.
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Thu Apr 16, 2015 4:33 pm

yes webstorage, but now there's a new LocalStorage that is replacing it.

it's pretty straight forward and not too hard to implement..
B
74
S
25
G
12
Posts: 1,061
Reputation: 13,019

Post » Thu Apr 16, 2015 6:30 pm

You could use System -> load / save game.

So, let's say at the beginning of each level (or even a checkpoint), you do.. System -> Save("auto")

Then player quits and comes back later.. main menu has a button "CONTINUE". On clicked, System -> Load("auto"). This will start the player exactly where they left off.

This is by far the easiest method but depends on your game. Using this method, you'll have to use the "no save" behaviour for objects that don't need to be saved, like scenery etc.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Apr 17, 2015 1:56 am

Image

Decided to go with a 2 dimensional array.

Just not sure how to save this using WebStorage

Something like:
WebStorage.localValue(THISLEVEL,0) to 1
WebStorage.localValue(THISLEVEL,1) to 1
WebStorage.localValue(THISLEVEL,2) to 1

Hope someone can help.
Thanks everyone.

P.S. I'm loving this program
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Fri Apr 17, 2015 6:17 pm

Got it I think

Answer should be:

1. Load in the 2 dimensional array at the beginning using JSON
2. Set the local key to the JSON
3. Access array through LEVELSARRAY.At
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Wed Apr 22, 2015 12:27 pm

Were you succeed?
?When everyone feels hope at the same time, wonderful things can happen.
B
5
G
3
Posts: 67
Reputation: 1,059

Post » Mon Apr 27, 2015 2:59 pm

Hi, i´ḿ from Cordoba(Spain). also I have the same doubt........I use google translator , and it costs me a lot work to solve some doubts.

My game is also based on levels. And I want to know how to save progress .....both runlevels as using save points.....

i have r200 c2.........(local storage works??)

Sorry to be so clumsy, but the language cost me a lot of work

appreciate if someone spoke Spanish to explain this.
(Si alguien habla en español para explicarme por favor, lo agradeceria)

thank you very much , sorry request .
B
7
Posts: 14
Reputation: 303

Post » Wed Apr 29, 2015 12:29 am

It's a bit hard explaining the full process on the forum. What you need to do first is read the excellent tutorial here:
https://www.scirra.com/tutorials/307/ar ... -beginners

Then once you have dived in and given it a try, you will have many questions to ask.
You then need to ask these specific questions on the forum in your own thread (probably the best way to get an answer)

I've only had Construct 2 for about 2 weeks and I'm well into this excellent program.
Most of the problems I've had, have been through rushing into things and not reading enough first.
The people on the forum provide some great answers but they need specific questions.

Some tips that I've learned regarding arrays and Construct 2 specific to my project:
1. In order to use arrays you need to add the array object first
2. Start off small and create a one dimensional array (properties window)
3. The term "webstorage" works on browsers and also when you export it to android
4. Use the debug window to check everything is working and to make sure values are being stored
5. Load the scores at the beginning of the game process
6. Store the scores as and when they happen (in case the app crashes/battery runs out etc)
7. To store "Level Complete" add a 1 to the end of the array
8. Take it in small steps, do one thing at a time and check the array in the debug window

My array looked like this
0 - 440 -1 = translates to 0 is the array key (starts at zero) - 440 (score for that level) - level zero complete (I named my first level zero 0)
1 - 221 - 1 = see above
2 - 532 - 1 = see above
3 - 0 - 0 = Level 3 - Zero score - Level not complete

I needed one array row for each level.
You can add up all the scores to show their high score from the array
You can flag up levels as competed by adding 1 to the last section

As mentioned I've only had Construct 2 a number of weeks so some of this information may be incorrect then again it may help.

Good luck
B
9
S
3
Posts: 146
Reputation: 1,150

Post » Fri May 01, 2015 9:14 pm

.....Thank you for the advice
goodness... i have i lot of patient.


So, thanks, i 'll read again .....
B
7
Posts: 14
Reputation: 303

Post » Fri May 01, 2015 9:28 pm

The use of webstorage is deprecated, so if you want to learn this stuff, better do it with the LocalStorage object from the get-go I'd suggest.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests