Saving games with custom names

Get help using Construct 2

Post » Tue May 16, 2017 12:52 pm

Hi

I am brand new to Construct, but love it a lot! Is there a way to make and name savegame slots avoiding arrays? I am making an app for autistic kids where user (parent) creates and saves different picture boards.
B
5
Posts: 3
Reputation: 231

Post » Tue May 16, 2017 3:14 pm

You can

That highly depends on your app.

What do you mean by "Picture boards"?
Are they just Sprites with different content?

If it's as simple as that, you can create a dictionary and save the Dicitonary as JSON in a LocalStorage key.
The advantage of LocalStorage is that you can have multiple Save slots, all renamed individually.

But to really help you, I will need more information from you.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed May 17, 2017 9:55 am

randomly wrote:Are they just Sprites with different content?.


They are exactly sprites with different content! One board contains 2 pictures (sprites) "first and then". "First" - is that the child has to do first, for example - clean his room (and there will be a timer for it). "Then" is what he gets for it, for example - "a candy" or he can "play games".

Parents create boards, pick pictures from their camera, name each picture and set timer for the first one. Then I need need to figure out the easiest way for saving each board either with custom name or the name could be "<first picture name> + <second picture name>"

Thank you for the tip, I am going to learn about Dictionary and JSON now :)
B
5
Posts: 3
Reputation: 231

Post » Thu May 18, 2017 7:00 pm

Thanks for explaining your project!

Sooooo, the way I would do it, is this:

Since Construct 2 comes with no built-in way to export the content of a Sprite, I'd recommend using this plugin.
It comes with has two important things:
  1. An .imageUrl expression that returns the image
  2. The action Load image that works similar to the Load from image URL in a Sprite, thus, accepting what has been returned by the .imageUrl expression

Now, how do you use this for your project?

The first steps stay the same.
When taking a photo, you simply load the Paster object with the image from the photo and so on.

Now, the important part: Saving all the image boards, plus text.

I would use an Array for this, where each line represents a board and each column stands for different parts of one board, e.g.
  • picture1, containing the imageUrl of the first image, same for picture2, just for the second pic.
  • firstTxt, containing the subtitle for the first pic
  • ThenTxt, subtitle for last pic
  • timer, containing the initial time

You see where this is going.

When creating a board, I would give each important object a value representing its board index.
This will be useful when saving, since you can then loop through all the boards.

In the loop, you fill the Array, using the loopindex as the Y index in the Array.

When the loop is complete, you can export the Array and its contents with the .AsJSON expression.
I would use LocalStorage to save it.

If you have any questions, please ask. If I find some free time, I will try to create an example .capx for you.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sat May 20, 2017 11:36 am

randomly, thanks a lot! I would figure it out by myself for quite a bit. The project sounds a bit more challenging then I expected, but it makes it more interesting :)
B
5
Posts: 3
Reputation: 231


Return to How do I....?

Who is online

Users browsing this forum: Felipiwi and 25 guests