Add Timer With Construct - 2

Introduction

Constructor is based on 2D game creation, without using coding. Thus, it is easy for game development, it is similar to the time necessary to make your ideas a reality. Some of the initial concepts,using constructor for game creation are given below.

  • It should be very friendly.
  • It should contain a lot of export options.
  • It should be inexpensive.
  • It must be able to make creativity into a reality.

Prerequisites

  1. constructor-2(free edition), it can be downloaded from the link https://www.scirra.com/
  2. Get licence.
  3. Collect the game object(online-sprite).

Construction

This article concept is based on adding Timer with Constructor Click File->New. Open NEW->Default new empty project.

 



Step 1

We need to change the active layer to main layer  by clicking on the main layer in layer bar & subsequently, we need to insert a text object. Change the name of the object, as per your desire. We can change this later too.

 

Step 2

To change the text size, we need to change the font property on text object. By clicking Font property, we can see a small box with three dots on it. By clicking it, a Window will open & we can change the font.



Step 3

Proceed, as shown below and provide a name for the object to something, which you want.

 

Step 4

To change the size of a text, change the text name afterwards(score). We need to change the Font property on text object by clicking Font property.

 

Step 5

To create a global variable, right-click in event sheet & select Add global variables. Afterwards, we can see a new Window. To add a global variable, the Timer is assigned by the global variables.

 
 
Step 6

Now, we need to provide a new text name-> Score object in add global variable dialog box. By right clicking Window stage, we need to provide the requirements given below.

Type
  1. Initial value
  2. Description(option).
 
 
Now, we need to open the event sheets & right-click the Window stage.

Steps needed to provided are given below.

  1. timer-text
  2. set text
  3. parameters name(“Time”& timer)
  4. open
  5. Done.
 

Step 7

Add an event. Click-on Open.

  1. System
  2. Every X-seconds
  3. Interval(seconds)current value change
  4. Done.
 

Step 8

Event sheet: ->Add events->System

  1. Subtract from
  2. Variables default timer change(score)
  3. Value 1
  4. Done.
 

Step 9

You need to make another event. This new event will set the Score text, pertaining to certain conditions given below.

Conditions

  1. Score-text
  2. Text(“Score”& score)
  3. Set Every X seconds
  4. Done.
 


 




 
 
 

Step 10

The Variables (timer) is assigned, when either game time is below 1 or when the player's life is equal to or less than 0. Thus, we will add an action to an event of restart layout, which is shown below.

 

 

Running Layout

Finally, the project is about to run.

 

Conclusion

From this article, we had seen the concept of adding Timer with Constructor. Thank you.

Up Next
    Ebook Download
    View all
    Learn
    View all