How do I run a built-in function in multiple events?

0 favourites
  • 5 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • With the old C2 functions, i was able to run the same function in multiple events, groups or sheets. It's not the case with the new built-in ones. If i run "On fuction dodisplz", i can't put another in a different part of my project. Is there a way to do that? possibly in an efficient fashion (using a trigger) and not involving an additional different fuction?

  • You can't add two functions with the same name. But you can call a function from any event sheet in the project.

  • Why would you want to do that? I can call my functions from other event sheets. In fact I have a whole event sheet just for functions and call them from my main event sheet.

  • Example: i have a fuction making the player jumping. In another event group concerning screen effects, the same function enabled an effect. I know i could simply unifty both actions when the function is called, but for organization sake i prefer doing that (and it was possible with the function system in C2).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You should have one function doing what you want and use function parameters if you want alternations of that function.

    Imagine you have 3 different versions of the same function on 3 event sheets and then you need to change huge portions of that function. Than you have to do every change 3 times instead of just one time. Also it can get messy if you forget to update some of these functions to the newest changes.

    I would probably use a Boolean function parameter so that you can easily enable or disable additional function behavior.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)