How to Learn Construct 3? Next Steps for Beginners

50
  • 82 favourites

Index

Features on these Courses

Contributors

Stats

64,610 visits, 250,973 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Unique IDs

The Unique IDs example is there to demonstrate a property of instances that allow you to differentiate between specific instances.

Read the explanation in the layout and test out the project.

When an event is read in Construct, all its conditions are checked.

If they all are true, the actions are executed.

In the event sheet, notice event 3.

The first condition is when the left button of the mouse is clicked.

This is called a triggered condition and it will only happen when the user actually does click on their left mouse button.

That is the moment this condition will become true.

The other condition picks the instance for which the UID property value is 3.

Picking means selecting an instance.

Conditions in events will select only the instance(s) that correspond with the condition.

In that case, since UIDs are unique, only a single instance in the whole project can be of value 3 at a time, so only a single instance is picked. If the instance was already destroyed, then no instance is picked, the condition is false.

Let’s go back for a minute to the previous example Instance variables.

At the time we had one instance of value 3 and the four other instances of value 0.

If we were to use the condition “Sprite: ClickCount = 0” (Adding the condition “Compare instance variable” of the Sprite object type), this condition would select the four instances for which ClickCount value is 0 and leave the instance with value 3 aside.

When instances are picked by a true condition, the actions that refer to the object type of those instances are applied only to the instances that were picked (selected) through the condition.

In the Unique ID example, only the instance of UID 3 is destroyed.

For the sake of testing, do right-click on the condition “Sprite: Pick instance with UID 3”, a contextual menu appears.

In this menu click on “Toggle disabled”.

The condition now has a line through it - a strikethrough. It will not be tested and Construct will act “as if it weren’t there”.

If you preview the project as it is, left click in the layout, all instances are destroyed.

When no specific instance is picked in the condition, an action will apply to all the instances of the object type.

Here, all Sprite instances are destroyed.

You can right-click and “Toggle disabled” the condition again to “enable” it again and on next execution, only a single instance will be destroyed.

This is the basics of picking, one of Construct’s strengths and also a pretty hard notion to master.

So take your time, practice and always keep in mind that’s how Construct’s events work.

As for UIDs, they are one of the ways to pick and identify specific instances in your project.

  • 17 Comments

  • Order by
Want to leave a comment? Login or Register an account!