Create functions to use them every where

Get help using Construct 2

Post » Sat Oct 12, 2013 1:27 pm

Hi,

I wanna learn how to create function to use it in event sheet.

I wanna do this for example like in javascript or php :
I have 3 box as layer and i want to use a function to show specific box (with passing variable of object or id ) when i need a box.

I wanna create a function which i can call every where i want

For example with jQuery :

function ShowHideBox(var1,var2{
          $(var1).fadein(1500);
          $(var2).fadein(1500);
}

I wanna create in construct 2 a specific event sheet (will be included in all event sheet), called : functions in order to use my function

And then in other event sheet i want to call my function like in javascript with : ShowHideBox(); but how to do this in Construct 2 ?

Thanks a lot for reading me !
B
3
Posts: 7
Reputation: 239

Post » Sat Oct 12, 2013 1:36 pm

You have functions in C2. Insert new object in layout and select function.

https://www.scirra.com/manual/149/function
B
15
S
3
G
3
Posts: 93
Reputation: 1,466

Post » Sat Oct 12, 2013 1:52 pm

yes but how to get variable passed ?

For example i want to pass variable to use them but how to get variable ?
B
3
Posts: 7
Reputation: 239

Post » Sat Oct 12, 2013 2:07 pm

thx that's ok
B
3
Posts: 7
Reputation: 239


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 7 guests