Add Button Fb Instant Games

Discussion in 'Buildbox General Discussion' started by luizcrf, May 8, 2018.

  1. luizcrf

    luizcrf Boxer

    Joined:
    May 7, 2018
    Messages:
    1
    Likes Received:
    0
    Hello, I'm developing a game for the facebook instant games platform and I need to add a preloader in the
    using the API.
    I did everything correctly, but I'm having trouble adding
    the blue "play now" button (Image: https://imgur.com/a/YmggUIP ) to make the game start only after
    the user clicks this video button: https: //youtu.be/Sjj_UKX549A


    Anyone who knows the facebook api could tell me the correct way to add this button?


    HTML

    Code:
    
    Hello, I'm developing a game for the facebook instant games platform and I need to add a preloader in the
    using the API.
    I did everything correctly, but I'm having trouble adding
    the blue "play now" button (Image: https://imgur.com/a/YmggUIP ) to make the game start only after
    the user clicks this video button: https: //youtu.be/Sjj_UKX549A
    
    
    Anyone who knows the facebook api could tell me the correct way to add this button?
    
    
    HTML
    
    <!DOCTYPE html>
    <html manifest="offline.appcache">
    <head><script src="https://connect.facebook.net/en_US/fbinstant.6.0.js"></script>
            <script src = "game.js"></script>
    </head>
    
    <body>
        GAME
    </body>
    </html>
    
    
    
    
    
    game.js
    
    FBInstant.initializeAsync().then(function() {
        FBInstant.setLoadingProgress(100);
        Module._fbinstant_inited = true;
        FBInstant.startGameAsync().then(function() {
            var windowWidth = window.innerWidth;
            var windowHeight = window.innerHeight;
            if(windowWidth > windowHeight){
                windowWidth = windowHeight / 1.8;
            }
            var gameWidth = windowWidth * gameOptions.gameHeight / windowHeight;
            game = new Phaser.Game(gameWidth, gameOptions.gameHeight, Phaser.CANVAS);
            game.state.add("Boot", boot);
            game.state.add("Preload", preload);
            game.state.add("TitleScreen", titleScreen);
            game.state.add("PlayGame", playGame);
            game.state.start("Boot");
        })
    })
    
    FBInstant.startGameAsync().then(function() {
      // Here we can be sure the player has already tapped play.
      myGame.start();
    }); 




    game.js

    Code:
    
    Hello, I'm developing a game for the facebook instant games platform and I need to add a preloader in the
    using the API.
    I did everything correctly, but I'm having trouble adding
    the blue "play now" button (Image: https://imgur.com/a/YmggUIP ) to make the game start only after
    the user clicks this video button: https: //youtu.be/Sjj_UKX549A
    
    
    Anyone who knows the facebook api could tell me the correct way to add this button?
    
    
    HTML
    
    <!DOCTYPE html>
    <html manifest="offline.appcache">
    <head><script src="https://connect.facebook.net/en_US/fbinstant.6.0.js"></script>
            <script src = "game.js"></script>
    </head>
    
    <body>
        GAME
    </body>
    </html>
    
    
    
    
    
    game.js
    
    FBInstant.initializeAsync().then(function() {
        FBInstant.setLoadingProgress(100);
        Module._fbinstant_inited = true;
        FBInstant.startGameAsync().then(function() {
            var windowWidth = window.innerWidth;
            var windowHeight = window.innerHeight;
            if(windowWidth > windowHeight){
                windowWidth = windowHeight / 1.8;
            }
            var gameWidth = windowWidth * gameOptions.gameHeight / windowHeight;
            game = new Phaser.Game(gameWidth, gameOptions.gameHeight, Phaser.CANVAS);
            game.state.add("Boot", boot);
            game.state.add("Preload", preload);
            game.state.add("TitleScreen", titleScreen);
            game.state.add("PlayGame", playGame);
            game.state.start("Boot");
        })
    })
    
    FBInstant.startGameAsync().then(function() {
      // Here we can be sure the player has already tapped play.
      myGame.start();
    }); 
     

Share This Page