Super Roguelike Engine

Last updated: Sep 6th, 2017

Start working

Step 1: How to install, into Construct 2 as a starter Template.

Open "C:\Program Files\Construct 2\startdlg.xml" with your favourite text editor and add this:

<template filename="super-roguelike-engine.capx">
<name>Super Roguelike Engine - Desktop Edition [Version 1.0.0]</name>
<description>Starter template for Construct 2 - to create a roguelike game of your dreams. </description>
Start Dialogue

Step 2: How to install, into Construct 2 as a starter Template.

Copy the file super-roguelike-engine.capx to "C:\Program Files\Construct 2\templates"

Start Dialogue

Layouts set up

Here i'll explain how the template layouts are set up in all the project.


Level 0 l_level_0 is where the player starts the adventure.

Level 1 l_level_1 is a regular dungeon for demo purposes.

Level 2 l_level_2 is a regular dungeon differnt tilemaps for demo purposes.


Loader Screen loader is the first layout for Construct to load.

Main Menu Screen main main menu layout in this layout all resources are placed to be loaded

Options Screen options options layout.

Loading Screen loading is a fake loading screen for each level.


Hud hud is where all the game UI elements are placed.

Camera camera a layout for acts as a camera.

Events set up

Here i'll explain how the template events are set up in all the project.


Level 1 e_level_1 a specific event sheet for l_level_1

When you want to add a specific events to a level you can simply add a e_level_n where n is the level number. So this way you can separate different events for that level.

Tip: Remember this when you add a new event sheet

If you add for instance a e_level_1 event sheet remember that this new event sheet must be set it up on l_level_1 on the Layout Properties in Construct 2 panel.

Layout Properties


Loader Manager loader_manager an event sheet for loader layout.

Loading Manager loading_manager an event sheet for loading layout.

Main Menu Manager menu_manger an event sheet for menu layout

Options Manager options an event sheet for game_manager event sheet.


Globals Manager globals_manager All global variables,functions that need to be available everywhere.

Game Manager game_manager this eventsheet is to controls all the game actions.

Hud Manager hud_manager this eventsheet is to controls all the game actions.

Lobby Manager lobby_manager this eventsheet is to controls all the game actions on l_level_0.

Quests Manager quests_manager this eventsheet is to controls all the game quests.

Game Set Up

Init & LocalStorage


Most of the global variables are started in menu_manager and it is one of the first layouts to load, then we use it to initialize the values of those global variables that we will need for the game.

Player Set Up

Player Composition

Our player is a container composition of various Sprites, such as:

  1. obj_player_mask
  2. obj_player_animations
  3. obj_player_sword
  4. obj_bow

Player Mask - is to make moves and check collisions


Player Animations - Self explanatory - to perform all player animations


All player animations

  1. ID_WALK
  2. ID_IDLE

Player Attack

This is a little tricky, since we add obj_player_sword as a Container of obj_player_mask, we place all the ATTACK animations in the obj_player_sword like this:

In Construct 2 - Editor


Since the Super Roguelike Engine has three different Swords, our player can switch between

Sword Animations

  1. IDLE_1
  2. ATTACK_1
  3. IDLE_2
  4. ATTACK_2
  5. IDLE_3
  6. ATTACK_3

Later in game_manager we check which Sword is equipped the play the animation according to the sword number

Player Corpse

Our Sprite for player when is dead


Player died group


Player Start Point on Levels

To set up our player in levels we only need to add the Sprite named obj_start_point on the level, here is where our player starts as far as Loading screen reach 100%


obj_start_point has an instance variable named level_number remember to set up this variable to the l_level_n. For instance in l_level_1 the obj_start_ponint level_number is 1

Quest system setup

Initially the player does not have any assigned quests, when entering the Lobby, and colliding with the NPC Karina will open a window of the Hud where the player is asked if he wants to accept that quest

On menu_manager we set up all init data for quets, like how many quests we want in the game


g_total_quests is an int variable set to 20

We store in a Dictionary, the pair KEY/VALUE like quest_1 = 0, quest_1_completed = 0

Later in quests_manager we can check which quest is completed

Adding a new Quest

Step 1: How to add a new Quest

Open the file super-roguelike-engine.capx go to tab panel Projects -> Files -> Dialogs -> AllQuests.xml double click to open the XML file, with your preferred Text Editor

Since the template already has two quests added you need to copy and paste below the last quest which is number 2, a code like this:

<quest id='3'>
<line id='intro1'>Welcome! warrior please I need your help, hunting monsters on the dungeons. </line>
<line id='intro2'>Please go to the first dungeon and hunt "20 Minotaurs" </line>
<line id='intro3'>Do you accept the quest? </line>
<enemies id='enemiestokill'>20</enemies>
<corpse id='sprname'>obj_enemy_minotaur_corpse</corpse>
<dungeon id='questdungeon'>2</dungeon>
<reward id='coins'>20</reward>

Very Important

Note that every id of the XML AllQuests.xml is single quoted

When you add a new quest the Lobby NPC, will automatically recognize that quest

Step 2: Check which enemy corpse we need to create

In the Everytick of quests_manager there is a group that is called "Quests: Killed Enemies" that controls which enemy we have just killed and if it is within the obj_enemy_minotaur_corpse name that we have selected in the XML AllQuests.xml then add 1 to the total number of enemies in this quest.

When enemies killed is equal to total enemies to kill, then the current quest is completed. Plus a Sprite will show on HUD so the player can claim the reward.


In order for the quest to work properly you must add an additional check in the group "Quests: Killed Enemies" as shown in the picture below.

This is what we do is create a Sprite type corpse according to the enemy we just killed

In this case we know that the enemy is a Minotaur so we create a Sprite with obj_enemy_minotaur_corpse

At the moment that we create the corpse Sprite , this code adds 1 to g_killed_enemies and so on.


With this will be enough to create a quest, as in game_manager already placed a condition for killing an enemy to generate a corpse, we do not need anything else.

Signs to show a hud box to the player, ike a tutorial messages, or any game message we want.

To place a new sign in the game you just drag a Sprite called obj_sign to the level you want and fill in the variable inst_sign_text with the text you want to show when the player is on collision with that sign

Quests Quests Quests

Inventory System

the inventory works based on Array, LocalStorage and Family, the ArrInventory Array is created with a dimension of: Width: 15 Height: 2.

The Family: Inventory is created with a variable of type int called: itemFrameOnInventory

An entry is created in LocalStorage with the key: inventoryKey type text like inventoryKey = myInventoryKey which is the variable where we will store the ArrInventory as JSON

The Sprites for Inventory:

In the main Layout you will find obj_inventory_1 this is the main Sprite to manage the inventory, has a variable called "itemFrameOnInventory" inherited from the Inventory Family, and we will use it to know what item we have collected in the game, based on its Frame


Player collison with Inventory Item:

When our player collides with an Inventory Item we use itemFrameOnInventory to identify which item we have to add to our Inventory and so display the Item on HUD


Here we're calling a Function AddToInv, which checks if there is a free slot to add this Item, and if the Item already exis then update it's Qty.


AddToInv function: Take two params

First Param: 0 is the item frame we want to add - right now is from 1 to 6 based on obj_inventory_1

Second Param: an int number to set the quantity of the Item

AddToInv calls to UpdateInventory Function


The Sprites for Inventory in HUD

In the main Layout you will finf obj_item_bg which is the button on HUD, for our player to use Items.


Inventory In Game

For instance here is our inventory in the game HUD with a Dash Potion in it.

So obj_item_bg has now a Dash Potion with the Qty. of 1 assigned to it's first slot.

The player can now use the item by clicking on it or pressing the assigned keyboard key which in this case is the key:1


Enemies System and Zones

Enemy type

  1. Regular enemy
  2. Creep enemy

List of current enemies and creeps

Enemies can have hp so when the player attack withdraw some of the hp

For instance: Minotaur are enemies of one hit kill, dragons has 100hp, you can set the enemy HP when is created.


Player Damage an enemy

  • Enemies
  • Minotaur
  • Ogre
  • Eyeball
  • Dragon
  • Flame

Creeps are one hit kill and they don't shoot.

As our player has a bow and a sword, to kill the flying enemies you have to use the bow and arrow.

  • Creeps
  • Bats
  • Termite

Zones on game

To enhance Construct 2 performance we're going to create enemies on demand, with a zone technique, how this is going to work:

Sprites involved

  1. obj_spawn - instance variables - int - spawned = 0, enemyName = obj_enemy_minotaur
  2. obj_zone - instance variables - Boolean - collided = false

In game player collision with Zone

Start Dialogue

In game_manager

What is going to happen here

When our player collides a zone we're set the boolean collided to tue

In a ForEach obj_spwn we check if spawned is equal to 0, so if is 0 go on.

If zone is collided equal true and obj_spwn is overlapping obj_zone then we check obj_spaw enemyName variable to assign the enemy.

Start Dialogue

The Game

Main Menu Screen

Start Dialogue

Each Button of the Main Menu Layout is assigned to an ins_menu_id so we can retrieve the ins_menu_id and identify which button was clicked.

  1. Start Game button inst_menu_id is 0
  2. Options button inst_menu_id is 1
  3. Delete Data button inst_menu_id is 2
Start Dialogue

Options Screen

Start Dialogue
  1. Sounds ON/OFF is a separated Sprite named obj_menu_sounds
  2. Music ON/OFF is a separated Sprite named obj_menu_music
  3. Back button inst_menu_id is 5

Lobby in game screen

Start Dialogue

Contextual help

When user press "Tab" key, display the game contextual help.
Start Dialogue

Player Dies

Start Dialogue

Floor Traps

Start Dialogue

Floor trap is an Sprite with a Default animation and the 0 Frame is set to 20 speed.

So we can controls if our player is overlaping obj_floor_trap_1 and if the current frame is bigger than 0, then the spikes are up so our player take some damage.

In order to play a sound the obj_floor_trap_1 has a inst_distance to check his current position and player position, so if the player is in distance range then play trap sound.


Floor Trap Damage our player

If our player is overlapping obj_floor_trap_1 and is not flashing already, is damaged

Start Dialogue

Hidden Areas

How hidden areas work in game_manager

Example: To place a hidden area just go to Layer TilemapHidden and draw some tiles to hide the Tilemap_map, since TilemaHidden is abobe when the game is running if the player is not overlapping a TilemapHidden the area is not showed at all.

In Construct 2 - Editor


In game


Treasure Chests

Start Dialogue

How chests work in game_manager

Example: Place a chest in a l_level_n and add some values, set inst_is_open to false, set inst_name to the color of the chest, leave inst_uid and inst_drop_rate to 0

  1. Brown chest name = brown_chest
  2. Red chest name = red_chest
  3. Silver&Blue; chest name = blue_chest

Actions between our player and chests

Start Dialogue

Health Fountain

How Health Fountains work in game_manager

When our player is overlapping the Health Fountain will gain HP and Dash points to replenish.

Start Dialogue

Dungeon Boss

Start Dialogue

End of Dungeon

Start Dialogue
Start Dialogue