How do I create a Function to Call?

Get help using Construct 2

Post » Fri Mar 07, 2014 4:47 am

Sorry, I'm sure this has been posted before, though I did try to search the forum for this.

I was looking through this part in the manual: https://www.scirra.com/manual/149/function. I like the idea of creating functions to save time on certain repetitive code/events. But I cannot for the life of me figure out where/how to add it to my event sheet.

When I click on System (event), there is no option for "On function". Likewise, there is no option in the actions for "Call function". I'm sure I'm missing something obvious, though.

Can anyone point me to where I can find how to add a function and call that function in my event sheet? Thanks in advance.
B
7
S
1
G
1
Posts: 56
Reputation: 732

Post » Fri Mar 07, 2014 5:02 am

you need to add the Function 'object' to your project just like you would add Keyboard support. Then you will see it.

double click anywhere on the Layout and then click Function.. this will add it to the project.. then you can call Create Functions and use Actions to call them...
B
96
S
31
G
15
Posts: 1,180
Reputation: 16,017

Post » Fri Mar 07, 2014 9:57 am

There's an on function and call function event and action respectively.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Fri Mar 07, 2014 12:34 pm

Wrote a small example here, that you might find useful.

https://www.scirra.com/forum/viewtopic.php?t=97305&p=743528#p743528
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Fri Mar 07, 2014 3:02 pm

Thank you, nimos100! I guess I didn't realize there was a function plugin to include for the project, that makes a lot more sense now. Also, I like your example in the other thread--I'll take a closer look when I get home and try this out.

*Edit to add: also thank you Jobel!
B
7
S
1
G
1
Posts: 56
Reputation: 732

Post » Fri Mar 07, 2014 3:16 pm

punkineo wrote:Thank you, nimos100!
...
*Edit to add: also thank you Jobel!

Not me? :o
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Fri Mar 07, 2014 3:39 pm

Dang it, sorry about overlooking your post! You too, Doc Ai :)
B
7
S
1
G
1
Posts: 56
Reputation: 732

Post » Fri Mar 07, 2014 4:46 pm

Punkineo if you want to learn about function then read my tutorial at

https://www.scirra.com/tutorials/823/creating-function
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,579


Return to How do I....?

Who is online

Users browsing this forum: rayolf and 17 guests