Call functions

Get help using Construct 2

Post » Tue Jun 25, 2013 10:19 pm

I wanna know if it is possible to call functions, or go and play some lines of my code, like C++ or something like that. I want to play my game and in some cases go and read again some lines above. Hope u can help me :)
B
6
S
2
Posts: 61
Reputation: 1,099

Post » Tue Jun 25, 2013 10:42 pm

B
13
S
6
G
3
Posts: 20
Reputation: 4,131

Post » Tue Jun 25, 2013 11:04 pm

Thanks!! but... where can i create those functions? I mean the manual is great but I dont find where is declarated the function.

Thanks again :)
B
6
S
2
Posts: 61
Reputation: 1,099

Post » Tue Jun 25, 2013 11:08 pm

the actions in a event with the condition "on called function" will occur when you called the function, an exemple
On called function "next level"
>Go to layout blablabla

On some condition: Call function "next level"
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Jun 25, 2013 11:13 pm

But when I want to declarate a function what i have to do? Its like defining an event? I dont find it

thanks again ^^
B
6
S
2
Posts: 61
Reputation: 1,099

Post » Tue Jun 25, 2013 11:48 pm

This is how you declare a function
Event: Function.On Function("function_name"). <===== declared

that's it. that's the deceleration. There is no more.

That's how you call a function.
Action: Function.Call("function_name")
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Tue Jun 25, 2013 11:49 pm

You do have to include the Function plugin, like other plugins. It's not part of the System.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Tue Jun 25, 2013 11:49 pm

It is defining the event "on called function"

That confuses me too the first time, but you just do

On called function "next level"
>Go to layout blablabla

To declare the function next level basically, when "next level" is called, the actions under "on called function" will be executed
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Jun 27, 2013 10:50 am

Thanks a lot to all. I didnt know that its a plugin! I thought my Construct was broken :( I'll try, thanks a lot, really :D
B
6
S
2
Posts: 61
Reputation: 1,099

Post » Thu Jun 27, 2013 11:09 am

Just to be precise, don't think of functions in C2 as "defined functions". It's more of an event called. You can have multiple "On function XXX" events, they will all trigger when you call the function. Functions are not defined, don't think of it as in JS for example.
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Next

Return to How do I....?

Who is online

Users browsing this forum: Fradno, marcinkowski, tarek2 and 8 guests