I'm seeking plugin developer to teach me.

  • I started looking into the plugin today. I don't think you can include the create function in the plugin itself, because according to the documentation that stuff is supposed to happen before the actual game is being started.

    This requires manipulation of the index.html file. I did something similar when I adjusted a game for the softgames API, which also required to initialize before the actual game is started.

    Will get further into this now and tell you guys more in the next few days. I think it should work out fine. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I hope you can figure it out how to do it.

    EDIT: I think I made it:

    ht*ps://w*w.scirra.com/tutorials/790/implement-fgl-html-5-api-in-construct-2

  • I hope you can figure it out how to do it.

    EDIT: I think I made it:

    ht*ps://w*w.scirra.com/tutorials/790/implement-fgl-html-5-api-in-construct-2

    That looks good!

    I'm just not sure you took care of the fgl.OnReady function. The game should only be started via the callback there. FGL might reject the game if that part doesn't work like described in the documentation.

    So just add that to what you already have in the index.html and you should be good.

  • I'm glad you guys are working hard at this, it will definitely help the community, keep at it!

    Just out of curiosity have you guys had any luck getting your games accepted into fgl using paala example?

  • PixelRebirth I don't know how to make the game start.

    In the example provided, in index.html:

    fgl.onReady(function(){

                new FGLNinja(element).boot();

    }

    Now in construct 2 I didn't found an equivalent of boot function to start the whole game.

  • some users requested for my plugin that they want to fix or finish, here is, it's almost organized with icon.

    I really don't know how to hack via index.html using special variable.

    https://dl.dropboxusercontent.com/u/76227787/FGL.zip

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • PixelRebirth I don't know how to make the game start.

    In the example provided, in index.html:

    fgl.onReady(function(){

                new FGLNinja(element).boot();

    }

    Now in construct 2 I didn't found an equivalent of boot function to start the whole game.

    At the bottom of the exported index.html file there is the script which starts the game.

    You can enclose that script in a function

    var loadGame = function() { SCRIPT HERE };

    then it should work:

    fgl.onReady(function(){

                loadGame();

    }

    Let me know how it goes.

  • So what else needs to be finished. Perhaps we can put a list and whenever a problem is solved we can cross it off that list.

  • <!-- The runtime script. You can rename it, but don't forget to rename the reference here as well.

        This file will have been minified and obfuscated if you enabled "Minify script" during export. -->

         <script src="c2runtime.js"></script>

         <script>

           var element = document.getElementById('c2canvas');

           fgl.create(element, 'com.fgl.gamename');

            //fgl.onReady(function(){loadGame();}

         </script>

          

        <script>

              // Size the canvas to fill the browser viewport.

              //var loadGame = function() {

              jQuery(window).resize(function() {

                   cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());

              });

              

              // Start the Construct 2 project running on window load.

              

              jQuery(document).ready(function ()

              {               

                   // Create new runtime using the c2canvas

                   cr_createRuntime("c2canvas");

              });

              

              // Pause and resume on page becoming visible/invisible

              function onVisibilityChanged() {

                   if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)

                        cr_setSuspended(true);

                   else

                        cr_setSuspended(false);

              };

              

              document.addEventListener("visibilitychange", onVisibilityChanged, false);

              document.addEventListener("mozvisibilitychange", onVisibilityChanged, false);

              document.addEventListener("webkitvisibilitychange", onVisibilityChanged, false);

              document.addEventListener("msvisibilitychange", onVisibilityChanged, false);

              //}

        </script>

         

    </body>

    </html>

    This is the final part of index.html , if I uncomment the parts you suggested to me the game doesn't load at all.

    mammoth The fgl api works, Pixel rebirth suggested that the game should load only after the FGl API has initialised. Now the game loads regardless if API was initialised . If there is a problem at FGL the game will load and throw errors when FGL api stuff is called. If the game was loaded only after the fgl api initialisation the game wouldn;t load at all.

  • Do you know if FGl will accept the game with the current plugin?

  • paala Did Show Ad and Show More games work with your implementation of index.html?

  • Yes show ad and more games works

  • Seems you're missing a semicolon at the end of each script block. Or did you paste it incorrectly?

    <!-- The runtime script. You can rename it, but don't forget to rename the reference here as well.
        This file will have been minified and obfuscated if you enabled "Minify script" during export. -->
         <script src="c2runtime.js"></script>
         <script>
           var element = document.getElementById('c2canvas');
           fgl.create(element, 'com.fgl.gamename');
            //fgl.onReady(function(){loadGame();}<font color=red>;</font>
         </script>
          
        <script>
              // Size the canvas to fill the browser viewport.
              //var loadGame = function() {
              jQuery(window).resize(function() {
                   cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());
              });
              
              // Start the Construct 2 project running on window load.
              
              jQuery(document).ready(function ()
              {               
                   // Create new runtime using the c2canvas
                   cr_createRuntime("c2canvas");
              });
              
              // Pause and resume on page becoming visible/invisible
              function onVisibilityChanged() {
                   if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)
                        cr_setSuspended(true);
                   else
                        cr_setSuspended(false);
              };
              
              document.addEventListener("visibilitychange", onVisibilityChanged, false);
              document.addEventListener("mozvisibilitychange", onVisibilityChanged, false);
              document.addEventListener("webkitvisibilitychange", onVisibilityChanged, false);
              document.addEventListener("msvisibilitychange", onVisibilityChanged, false);
              //}<font color=red>;</font>
        </script>
         
    </body> 
    </html> 
    
  • Is this the line that is giving the problem?

       //fgl.onReady(function(){loadGame();};

  • paala would you let me to cannabalize your index.html and release in plugin subforum? I was thinking it could modify a line in index.html from C2 exporter like how they did for Blackberry 10 XML.

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