1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Button “play game” in preload - facebook Instant games

Discussion in 'Facebook API' started by marcbr, May 7, 2018.

  1. #2
    Hello, I added the preloader in my game using the API of facebook instant games,
    but I'm having trouble figuring out how to add the blue "play now" button Image: https://imgur.com/a/YmggUIP

    How to proceed to give this action to the game?


    <!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>
    Code (markup):


    FBInstant.initializeAsync().then(function() {
        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);
     FBInstant.startGameAsync().then(function() {
      // Here we can be sure the player has already tapped play.
    Code (markup):

    Last edited by a moderator: May 8, 2018
    marcbr, May 7, 2018 IP