How do I save option to remain even though close the game?

Get help using Construct 2

Post » Sat Oct 29, 2016 11:10 pm

Hello, I have a problem, how I can create a save option, to remain even though close the game on android?, for example, if I put the sound to be silent, I want that value remains when re-entering the game (sorry for my english is not very good)

Image
B
42
S
12
G
2
Posts: 21
Reputation: 3,733

Post » Sat Oct 29, 2016 11:14 pm

GhostDev wrote:Hello, I have a problem, how I can create a save option, to remain even though close the game on android?, for example, if I put the sound to be silent, I want that value remains when re-entering the game (sorry for my english is not very good)

Image

You'll need to use the system "save" events.

Ex: On left clicked on "ChangeSoundSprite" -> System - save "save1"

And then: on start -> System - load "save1"


P.S. The game looks really cool btw!
ImageImageImageImage
B
27
S
9
G
7
Posts: 229
Reputation: 5,493

Post » Sat Oct 29, 2016 11:31 pm

You could also try the "LocalStorage" object.

Actually, I'd recommend you use the "LocalStorage" object rather than a whole savegame system since LocalStorage gives you control over what you save, takes up less space and consumes less CPU.
"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 » Sun Oct 30, 2016 1:50 am

randomly wrote:You could also try the "LocalStorage" object.

Actually, I'd recommend you use the "LocalStorage" object rather than a whole savegame system since LocalStorage gives you control over what you save, takes up less space and consumes less CPU.


I used but it does not work, when I leave the game and I get back into again the options are not saved, I do not know if I'm doing something wrong I may have to try system "save" events...
B
42
S
12
G
2
Posts: 21
Reputation: 3,733

Post » Sun Oct 30, 2016 11:50 am

So, how did you implement LocalStorage?

Could you upload a screenshot?
Also, make sure to make the event-chain look like this when getting the key:
Code: Select all
Get item "volume"
On item "volume" get
     -> set volume to LocalStorage.ItemValue
"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 » Sun Oct 30, 2016 6:48 pm

randomly wrote:So, how did you implement LocalStorage?

Could you upload a screenshot?
Also, make sure to make the event-chain look like this when getting the key:
Code: Select all
Get item "volume"
On item "volume" get
     -> set volume to LocalStorage.ItemValue



Image
B
42
S
12
G
2
Posts: 21
Reputation: 3,733

Post » Sun Oct 30, 2016 9:34 pm

I guess, "sonido" is your sound volume?

Seems like you're doing everything correctly.
No idea what's the issue here. Still, I wouldn't switch to the save system, but rather wait for somebody more capable than me to answer this 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 » Sun Oct 30, 2016 10:38 pm

Thank you anyway randomly :)
B
42
S
12
G
2
Posts: 21
Reputation: 3,733

Post » Mon Oct 31, 2016 3:14 am

You forgot to put in a command that when you press the button, the information should go into local storage. Here download my simple shop system capx file to see the commands. This capx will help you with this problems and any other future problems with local storage

http://www8.zippyshare.com/v/lMXzxvFU/file.html
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Mon Oct 31, 2016 12:02 pm

PixelPower wrote:You forgot to put in a command that when you press the button, the information should go into local storage. Here download my simple shop system capx file to see the commands. This capx will help you with this problems and any other future problems with local storage

http://www8.zippyshare.com/v/lMXzxvFU/file.html


Thank you!!!!!!!!! Now it works
I had the command, but was wrong, thank you very much for your help PixelPower :D
B
42
S
12
G
2
Posts: 21
Reputation: 3,733

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Google [Bot], tarek2 and 10 guests