Title: HOWTO Javascript game with Satoshi bonus Post by: svinuga on April 05, 2018, 09:41:08 PM There are thousands of free open-source Javascript games out-there. If you are running a game website, why not to get a leg-up over the competition by rewarding the players? You can always re-capitalize on the ads.
For this example we gong to use classic Tetris game - marvelous Blockrain game at https://github.com/Aerolab/blockrain.js (https://github.com/Aerolab/blockrain.js). It has DIV to run inside: Code: <div class="game" style="width:250px; height:500px;"></div> Code: $('.game').blockrain({showFieldOnStart: true}); This one has handy callback: Code: onGameOver: function(score){ So, let's create the game bonus faucets, using URL of your game page as the URL in the faucet configuration for all of them. The more bonus faucets you create - the merrier. Firstly, it keeps the player motivated, secondly - it increases you game page visibility in the Remote Faucet List (https://wmexp.com), and in the Faucet (App) list of the micro-payment system your Remote Faucets going to use (for example, here (https://cryptoo.me/rotator/) ). If you are not familiar with creating the Remote Faucets - see this example (https://wmexp.com/remotely-hosted-bitcoin-faucet-examples-list/example-creating-remote-faucet/) first. For the simplicity of the example we will use 5 Remote faucets as the rewards, first (score 10 000 and bellow,"Tetris bonus 10K", second (score 20 000,"Tetris bonus 20K", FaucetID 123682) ... fifth (score 50 000,"Tetris bonus 50K", FaucetID 123685). Now, let's modify the HTML so we have the place to show the faucet when the game ends: Code: <!-- And the final touch, let's create a function to select the correct faucet Id depending on the players score, hide the game, and show the faucet. Code: <script> Code: <script> That's it ! :) It is impossible to insert the game here, so if you want to see it in action - look here (https://wmexp.com/remotely-hosted-bitcoin-faucet-examples-list/example-game-bonuses/) (scroll to the bottom) |