Saving preferences to cookies

little test on how to save a preference made in wick in a cookie and retrive it.cookiePref_0001.wick (4.1 KB)

every time you choose a different shape your choice is written in a cookie.
When you stop and restart the project it first check for the cookie to see what was your last choice and write it in the textfield

it can be useful to record and restore game states, players preferences…

need to be played in the browser editor (cookies wont work in desktop version)

4 Likes

And here the same project with preference saved in local storage instead of cookies

localStorage_pref_0001.wick (3.9 KB)

1 Like

I personally prefer using the local storage b/c I’m used to it, but I see how using cookies would be more useful. I didn’t even know u could use cookies in wick until know!

Thank you @blurredPixels for sharing the project : )

1 Like

I wont say cookies are better. there are little differences.
with cookies you can set an expiration date should you need it

I can keep track of my cookies easier from my settings, which is why I prefer them.

But an expiration date sounds interesting :thinking:

How can i mod this to save a game? I want it to save whenever a new level is reached/flag is touched.
Game File

I would save the last completed level. Much easier than saving the actual last position and game state of the player.
At game start check if there are completed level saved and start the game from there.

The think is I’m not really good with code so I don’t really know how

The truth is that nobody was born knowing programming. If you really like game development, you should start learning as many of us did a while ago. Once it clicks on your head, you will see that it is not as difficult as you thought.

1 Like

Thanks for the motivation, can you start me off in the right direction, maybe a few tips or some good resources like w3schools i can use?

1 Like

there’s khan acedemy

2 Likes

I use Youtube all the time… There are good javascript tutorials for beginners. Then, when you have more knowledge, google will be your friend… search for “How to do [whatever you want to do] in javascript”.

2 Likes

thank the programming gods for google

w3school, tutorialspoint, javascript.info are all good

In my opinion one of the key point in coding is that before you learn the language your device speaks you want to know what you want it to do.
You want to do a game.
Ok. This is not enough. There is no programming language that take a make_the_game_I_have_in_my_mind() command.
You have to split the big task (the game) in many more simpler commands and then focus on the language

In the specific case of your game you start with an intro that lead to game mode selection.
In the page of game mode selection you can check if the last played level cookie is set.
If true you can give the choice to start the game from the next level.
and every time the player end a level you have to update your cookie value

1 Like

So I don’t really know how to do the cookies, though i do know how to use commands to switch frames, so that if the cookie is set, the select level button will be offset to the right and the load save button will appear

w3schools = the coding scroll of truth

have a read here

1 Like