How to save game in a Clicker game?

I want to save game in a Clicker game with the button of Save and Load button, it is just one screen, i want to save all in that screen (number of clicks done, buttons, labels, and image). Which are the blocks? Thank you
i searched in youtube but they only confused me cause they only save lists. and i dont want that.

Welcome,

Can you show your Clicker game and the blocks you made? This way it will be easier to help you.

I once made a real simple Clicker game that uses a TinyDB to store the number of clicks.

I didnt do anything of saving game. Just need the basic blocks to start it. At the end im going to put a load button.
I have a problem. I put press save button so when you click it save value Screen. But with load button, if ou click load button, i can not put Call valou screen, i cant join it, need a block of set Screen as: and then call value. And the Screen blocks dont have a block of setting the whole screen, only the title, about, and othe stuff.
By the way i dont know for what purpose is the Aboutscreen section.

I know but if you show your blocks we can guide you better. Like i said use TinyDB to store values and get them when you open the app again.

http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB

By the way. Why do you have two accounts here with the same name Dhun and Dhun1?

Please read the post before, i edited it.
the two accounts is cause they didnt let me in , and need to do another one with google account, the other is my normal email.

I wonder if you’re a little confused here.

Saving “Screen 1” as a value into TinyDB does not save the individual values of what you have on Screen 1. You need to save each thing separately.

For example, you’ll need to save “Score” in TinyDB and then call it and set it to the correct label when resuming the game.

Same goes for other things such as Lives, Clicks, etc.

In other words, you need to save each thing on your screen individually.

When you click Load Button then you need to set labels, variables etc using the tags you used to save them.

1 Like

Ok. i expected that. Lot of work. What i dont understand is the use of variables. Is there some document about it or how to use it to save game, or when i need it to save game if i need it. Hope for save labels dont need it.
Thank you very much

It’s pretty much the variables you will be saving into TinyDB.

While the game is being played the variables will update depending upon what is going on. When you press Save each variable is saved into TinyDB with its own unique tag.

When you press Load each saved tag in TinyDB is assigned to the relevant variable and then you can resume the game.

If labels just tell you the variables in a numerical fashion - ie the Lives label just shows a number - then you don’t need to save labels individually because you will set Label Text to Global Variable. However, if certain buttons or labels need to be visible or invisible at certain points during gameplay then you will need to save their visible property as true or false into TinyDB.

The more complex the game, the more work there is to save and load.

1 Like

A very good way to learn App Inventor is to read the free Inventor’s Manual here in the AI2 free online eBook http://www.appinventor.org/book2 … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

I did the blocks of saving the clicks done in the game. but without variables. only storevalue and obtain value.
and i tried it in AI Companion and told me this

The operation + cannot accept the arguments: , [“com.google.appinventor.components.runtime.Label@37ebac1”], [1]
Note: You will not see another error reported for 5 seconds.

com.google.appinventor.components.runtime.Label@37ebac1 this is what appeared in the label instead of the clicks done in the gamebloques

You are trying to store the component “Clicks” rather than the value of the component “Clicks”

Use the block “Clicks.text”

1 Like