Step 1 - Visit the Y8 Account Stencyl SDK Github page. Click the green download button to get the stencyl Y8 Account extension.
Then install it and you’ll see new code blocks.
Step 2 - You should have 3 different scenes.
- To load local saves (loadScene)
- For banned sites (lockedScene)
- To load online saves (mainMenu)
Duplicate the game attributes you want to save in cloud (use the prefix “cloud” - it’s useful)
Step 3 - Scene: loadScene
Example code for loading local saves
First, we must initialize the app. After loading, set your game attributes with the prefix “cloud” as default. This is an important part. Also, create a game attribute
Step 4 - Scene: mainMenu
Example code for loading Y8 Account saves.
This code should be in for the update event. Before loading, you must save your non-cloud game attributes in local attributes (create local-blue attributes for it), and after loading use local-blue attributes to feed in their respective saved values. This is very important.
Use the following code for banned sites.
Step 5 - Example code for saving (Y8 Account and local).
Step 6 - Example code for unlocking achievements.
To display the achievements menu.
Step 7 - Example code for submitting high scores
To show the high scores menu.
Step 8 - Example code for any menu button which might be covered by Y8 Account UI
First, we must check if a Y8 Account UI is open or not.
Step 9 - Example code for choosing save type (local or Y8 Account)
Step 10 - LockedScene
A LockedScene can look something like this.
Add actor to the lockedScene.
Example code for this actor. This code lets the player highlight and copy/paste the correct game link in their browser.