Call C2 Function as callback for external js.

  • My client requested me to add his advertising into game. Call to Browser.ExternalJS needs to have this form:

    request(fnPause, fnResume)

    Wchich means I need to pass js functions there that will stop or resume gameplay. How do i do that?

    Preferably WITHOUT writing plugin. If plugin needs to be written im willing to pay for it.

  • Is there a way to get access to timescale with ExternalJS I dont care how dangerous it could be. Need to have way to change it on those callbacks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there a reason it should be externally?

    Why not use what you have at your disposal inside Construct2?

  • Is there a reason it should be externally?

    Why not use what you have at your disposal inside Construct2?

    Because I need to call external js to show ads and their js needs to control if game should be paused or not. Thats how it needed to be done - Ive managed.

    I just had to hack my code inside of prototype.logic function with simple boolean that optionally skips whole logic loop. Added 2 window functions - stopGame and resumeGame they are basically available everywhere as "cr_..." function is called in index.html.

    Only disadvantage is that i will have to edit my c2runtime everytime I make adjustment for client but it only takes 1 minute so I can live with that.

  • You should just write a plugin. It really shouldn't be that hard if you already know javascript.

  • You should just write a plugin. It really shouldn't be that hard if you already know javascript.

    I dont know JS. I do have coding experience but I pretty much hate JS.

    No idea also how this sort of plugin would work. How would it allow external js to control game timescale.

    Either way hacky workaround is good enough as it does job it should.

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