Menus

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.

Managers

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.

Levels

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.

Menus

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.

Managers

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:

obj_player_mask

obj_player_animations

obj_player_sword

obj_bow

Player Mask - is to make moves and check collisions

Player Animations - Self explanatory - to perform all player animations

All player animations

ID_WALK

ID_IDLE

ID_BACKWALK

ID_FRONTWALK

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

IDLE_1

ATTACK_1

IDLE_2

ATTACK_2

IDLE_3

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

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

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

Regular enemy

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:

In game player collision with Zone

In game_manager

What is going to happen here

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.

The Game

Main Menu Screen

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.

Start Game button inst_menu_id is 0

Options button inst_menu_id is 1

Delete Data button inst_menu_id is 2

Options Screen

Sounds ON/OFF is a separated Sprite named obj_menu_sounds

Music ON/OFF is a separated Sprite named obj_menu_music

Back button inst_menu_id is 5

Lobby in game screen

Contextual help

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

Player Dies

Floor Traps

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

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

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

Brown chest name = brown_chest

Red chest name = red_chest

Silver&Blue chest name = blue_chest

Actions between our player and chests

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.