Construct 2

Construct game development is supported by community-maintained Construct plugins that implement the LoL-supported Javascript API.


While Legends of Learning does not directly support Construct game development, the game developer community has created Construct2 plugins that implement the LoL-supported Javascript API.

Plugin Source Code

Source code for the community-maintained plugins is available on Github.

Community Forum

Refer to the game developer community forum for additional information and support.

Example Project

To see how to use the API in a very simplistic Construct 2 'game' download lol-construct-api-sample.capx. You will need to install the two LoL plugins available from source on Github, as well as the BBCodeText plugin from rex_bbcodetext.

Construct 2 API

Your game will communicate with the LoL platform through Construct 2 conditions and actions.

Usage Guidelines

Getting Started

The first step is to obtain the LoL Construct 2 plugins from Github. There are two plugins, lol-main.c2addon and lol-questions.c2addon, which can be dropped into your Construct project.

If you have previously installed the LoL plugins and want to upgrade, just drag the new c2addon file onto the project. Construct 2 will show the version and let you confirm that you want to add the new plugin.

The Construct 2 IDE will show parameter level documentation for each action and condition. For additional context, please see the sample 'game' in the resources.

Build and Run

  • Export as an HTML 5 Website

  • On 'Choose template' step, pick 'Embed style'

Transition to your Game

LoL will show its own splash screen while your game is loading. Enable loader layout so you can use the SendLoadingProgress action on the LoLMain object to communicate loading progress to the platform.

Once your game loads it must use the Init action on the LoLMain object so the platform knows it can remove the splash screen and show your game.

Warning: If your game does not use the Init action then the game will never be seen. And it would have been epic!

Transition from your Game

When the student completes game play, use the CompleteGame action on the LoLMain object so the platform can transition the student to a review of your game and then on to the next game.

Warning: If your game does not use the CompleteGame action then the student will not be able to proceed.

Pause and Resume

Student game play may be interrupted by the teacher so she can provide instructions or help the class with the material. When this happens, the platform will display a splash screen. When the teacher resumes play, the LoL splash screen will disappear after ensuring that the student is ready to resume game play.

The LoLMain plugin automatically calls the Construct 2 global function cr_setSuspended when it receives pause and resume messages from the platform. No additional logic is needed in your game.

Tracking Player Progress

You must have at least 8 progress increments in your game. As a result, your game must use the SubmitProgress action on the LoLMain object a minimum of 8 times during the course of a complete game to provide game-play progress updates to the LoL platform. We recommend 15+ progress points so the platform can provide a more fine-grained progress bar to the student's teacher. Progress values must never decrease during the game.

If your game has a concept of score then include it when you use SubmitProgress. Score is how well the student is doing in terms of game play. For example, coins earned killing dragons rather than their academic score answering questions. The scores will be visible on a Leaderboard for the class. It is not required to have a concept of a score (you may not have a score if you are exploring a room).

Each Progress (and optional Score) value becomes the new value -- they are not added to previous values. You must also include a Max Progress value that must be equal to the highest possible currentProgress value and must remain constant throughout the game.

The following screenshot shows the global variables for score and level being passed as parameters for the Submit Progress action.

Questions and Answers

Some, but not all, games will include curriculum-based questions and answers. LoL has assembled a data-bank of professionally-developed questions and answers for each Learning Objective, which are surfaced through the lol-questions plugin.

You may choose to write your own questions and answers and therefore not use our question bank. This gives you more flexibility, but removes the game's interaction with our platform. As a result a teacher will have less insight into how her students are performing and may rate the game lower as a result. Many games will not have in-game questions, and of those that do, many will not use our question bank. It is your choice.

If you DO want your game to pull questions from our database and post answers then you need use the 'On Questions' condition from the LoLQuestions object. Once the condition is met, the expressions in the LoLQuestions object will have all of the data that you need to present the current question. The following screenshot shows a RenderQuestion function that uses the expressions to set the text values of objects in the layout.

Markup in Questions

The questions in the LoL data-bank may include simple HTML markup for italics and bold. Construct 2 does not support HTML but there is a plugin that supports BBCode. The lol-questions plugin converts HTML markup to BBCode.

You will need to install a third party plugin, rex_bbcodetext, to render the BBCode.

Images for Questions

Some questions include images which must be displayed relative to the text of the question so that the question makes sense. The expressions in the LoLQuestions object include the text to display before the image, the text to display after the image and the url for the image.

Images in questions can be quite large. Plan to allocate roughly a quarter of the screen to images when displaying questions. With that said, you can scale or position as needed as long as the images are still legible.

Submit Answers

When a student answers a question use the SubmitAnswer action to post the answer to the platform.

Note: A game may also include its own questions and answers based on the learning objectives. In that case the results are not submitted via SubmitAnswer.

Last updated