Jump to content

Button “play game” in preload - facebook Instant games


luizcrf
 Share

Recommended Posts

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
And make the game start only after the user clicks this video button: https://youtu.be/Sjj_UKX549A

How to proceed to give this action to the game?
HTML

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();
});

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...