Play game button - fb instant games

Discussion of tools and resources for game developers

Post » Tue May 08, 2018 6:37 am

Message: luizcrf can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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: Select all
<!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

Code: Select all
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();
});
B
1
Posts: 1
Reputation: 127

Post » Mon May 14, 2018 2:07 am

that button automatically appears when you post the game on instantgames platform, and is detecting the facebook server (that button is part of the default instantgames C2 plugin when detects loading of the app), you should see a loading from 0 to 100 and a play now (however the play now button will just load things in a faster manner, is like 1 second difference). for me was automatically you don't need to do nothing else, but to correctly implement your instantgames developers dashboard app settings, from what i seen and experienced.
ImageImageImageImageImageImage
B
87
S
26
G
75
Posts: 1,458
Reputation: 47,940


Return to Tools and Resources

Who is online

Users browsing this forum: No registered users and 4 guests