Savestates!

Get help using Construct 2

Post » Fri Jan 24, 2014 12:51 pm

Hi guys.
So a brief description of the situation:
My app has a homepage, upon the start of the layout I have set it so it loads a specific savestate. This causes it to change the layout to the one where the savestate was made. Is there a way to create a savestate which doesn't remember layout (i.e. just remembers variables). I know you can set some objects to not be saved however I can't work out how to make it so that the current layout position doesn't save.
Thanks in advance
B
4
S
1
Posts: 32
Reputation: 418

Post » Fri Jan 24, 2014 1:06 pm

I also can't seem to be able to keep the savestate upon closing the app (and removing it from running applications). No idea why. Running on androidReverate2014-01-24 14:28:38
B
4
S
1
Posts: 32
Reputation: 418

Post » Sat Jan 25, 2014 1:10 am

I've seen a number of people mentioning using Globals for storage and saving level data etc.

Is it not better (practice) to create arrays and use them, something like this?

You need two arrays one for your user data one for the level data.

1          2          3          4               [Userid]
Tim      Tom        Jim        Jon             [Playername]
1          1          2          3               [Difficulty]
Off       Off        25        75              [Music volume]
On        On        Off        On              [WebGL]
On        Off        On        Off            [Particles]
Red      Blue        Green   Yellow        [Favourite colour] etc etc.

You will need to collect this data and these preferences to populate the array

Something like a 6 X 8 X 1 would allow you to really let the player customise their game settings.

(You did notice that doing it this way immediately introduces the age old concept of multiple game slots didn't you?)

Create a "Load Game/New Game" Layout.
Populate the load slots with the relevant usernames from the array and make them clickable linking to control panel page.

If total num slots > number players already registered

then make visible a new player textbox. Tip ->(Player chooses name but system allocates Playerid on submit)

Both options (existing and new)should divert to control panel page for user to select their preferences. Set it up so exiting the cp will store Userdata collected thus far use Playername for individual saveslot.

You now have a list of players and their game preferences, and if you planned ahead you might already know their last level etc or anything else you would like to tie to the player in the Userdata array.

The levels array is simple, no levels X 2 X 1.

0    1,4000
1    3,1500
2    5,2500
3    1,0
4    0,0
5    0,0

Index level status (eg locked = 0, unlocked = 1, one star = 3) and highest score to date on that level. This simple array when added to the data which you harvested into Globals from the Playerdata array gives you all the information you need to do an angry birds 1-2-3 star menu layout etc with previous highest score for each level plus a cumulative high score to date all in just two simple arrays.

Why so simple?

You created a number of users who are identified by name and number.

When a new user is added to the PlayerData array, the logic creates a LevelsArray and saves it under that Username.

Tip Don't use persistent names such a "savegame" use variables such as "savegame"&Userid or simply Username (no duplicate check completed of course).


This probably doesn't seem particularly simple if you're unused to arrays think of it as two relational db tables joined by the key "Username". Collecting the data is as easy as using conventional HTML forms (which is basically what they are in C2 anyway)

Before I go let's just pop back to that first 6X8X1 array we created userdata.

Now what if we were to change the dimensions to something such as 6X8X2?

You've just provided each player with sufficient storage for an Inventory.
There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Tue Jan 28, 2014 3:52 pm

Hi,
Thanks for the reply, however I am still struggling with the issue about it not remembering the savestate after closing the app from the app launcher.
B
4
S
1
Posts: 32
Reputation: 418


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests