Step 1 - Visit the Stencyl SDK Github page. Click the green download button to get the stencyl extension.

Then install it and you’ll see new code blocks.

Step 2 - You should have 3 different scenes.

  1. To load local saves (loadScene)
  2. For banned sites (lockedScene)
  3. 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 NeedLoadingCloud.

Step 4 - Scene: mainMenu

Example code for loading 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 ( 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 UI

First, we must check if a UI is open or not.

Step 9 - Example code for choosing save type (local or

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.

import flash.text.TextField;
import flash.text.TextFormat;

var txt = new openfl.text.TextField();
		txt.width = 500;
		txt.height = 500;
		txt.x = 190;
		txt.y = 200;
		txt.wordWrap = true;
		txt.type = INPUT;
		txt.mouseEnabled = true;
		txt.selectable = true;
		txt.textColor = 0xffffff;
		txt.multiline = true;
		txt.wordWrap = true;
var lockText = "";
		txt.text = lockText;
var formato:TextFormat = new TextFormat();
formato.size = 28;

txt.text = "";