Advanced Tips and Tricks that Construct2 Offers ...

  • 46 favourites


4,241 visits, 6,407 views



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.

Hello All ,

I'm here to teach you some of the most advanced techniques you can find in C2 ...

You'll find those very useful because they can have the potential to drastically reduce the numbers of events you may need to make a game ...

Now that I took your attention , let's get started , shall we ?

Note \\ If you find any errors in the text , feel free to correct me

Wait 0 Seconds

Wait 0 seconds is designed to postpone until the end of the current run of events (not even the next tick - the same tick, but after all other events).

Explanation :

Condition 1

.. Event1

.. Event2

In this case , event 1 & event 2 will occur in the same tick

Condition 1

.. Event1

.. Wait 0 seconds

.. Event2

Putting a 0 seconds will insure that Event2 will only occur after Event1 is finished

Some examples ...

On start of layout

.. Destroy Object1

.. Set Variable1 to Object1.Count

Here , the two events occur in the same tick , meaning the object is created in the same moment as the variable is changed , The object isn't destroyed yet , so the variable is assigned before the object count is egal to zero ... Doesn't work .

If you place "Wait 0 seconds" between the two , C2 will destroy the instance , wait until it is successfully destroyed , and then assign the variable , in this case , set it to 0 ...

This trick is very useful when you need to call a function then call another depending on the result of the last one ...

Calling an event when a loop is finished

To verify if a loop i finished , many users set variables an complicate their lives ... I found a very useful trick in the event system that can help you determinate if a loop is finished or not ...

Event run in order from top to bottom , and sub-events also run in order from top to bottom , and if there are many sub-event , one may only run if the other already finished ...

Top level event

.. Loop

.. Your event that will execute after the loop

This trick can be used after any loop ... some of the uses ...

Every tick

... For every element X/Y

---- Current Value = 1 ; Create object1 at (CurX,CurY)

... Every tick ; Destroy Object1

Power of Functions

You may know this one but I always highly recommend it , use functions ...

Combined with the tips I taught you not a long ago ... the Functions Real Power is unleashed ...

Just be sure to not loop functions each tick ... or you'll get Javascript errors ;)

--> This will Happen!

That's all for today folks , I hope you learned , if you did , click that star and help other people find this tutorial ...

See you soon !


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