Calling html5 functions with function action?

0 favourites
  • 4 posts
From the Asset Store
Shoot your way through with these 4 exciting, fun, energetic, and upbeat music tracks and 14 sound effects
  • This is kind of important for me.

    For one of my publishers I need to add a few empty function calls, so they can later add their own code to those functions via javascript I imagine. So my question is, if I just use the default C2 call function action with an event, is this going to work?

    For instance, if I use an event with Function call "levelcomplete", and then I tell them the functions names, are they gonna be able to add their code in the html5 files? Or the C2 functions are different than the normal html5 functions?

    If this isn't gonna work, can I use a plugin to achieve this?

    I'm gonna add another example just in case: one of their rules is that every game needs to have a "More Games" button in the main menu that will link to a website when touched, so they ask that you use a click/touch event and a function call, and then communicate that function to them so they can add their own functionality.

  • Well, I did some testing and it seems they are indeed different. If anyone is interested, I managed to ejecute javascript functions using the C2 plugin "CallJS" with just a simple event. Hopefully it's gonna work for them too.

    Now I wonder if there is another plugin which can listen to external code, the purpose is for creating conditions. Example: if an external javascript function is called, do something?

  • You might want to write a custom one-off plugin for this:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ... So my question is, if I just use the default C2 call function action with an event, is this going to work?

    Short answer, no. The inbuilt function call mechanism is for executing C2 actions, not JavaScript code - as I think you've discovered.

    As you've also discovered, the third-party CallJS plugin should meet the first of your requirements. And for the second, as Ashley indicates, you should write your own plugin.

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