Creating a Game in Construct 3 with the GamePush Plugin
You will find out how to add plugin, banners and leaderboard to your game. You will learn to work with player's saves.
The plugin can be downloaded under the link.
As a basis, we will take an idea to tap the square more than anyone else in a definite time.
As soon as the player loses, he is offered the option to extend the game for 5 seconds by watching ads.
After completion, the player goes into a menu. There displays his best record, rating position and number of attempts. In the menu, you can start a new game and see the leaderboard.
Mechanics are implemented in 4 blocks:
At the start of the game, we reset all states to default.
Every second, while the timer is ticking, subtract a second from the timer and check if it is over. If it is so, then we check whether the player took the reward. If he did, then we end the game, otherwise we show the offer to watch the video.
On click: +1 to taps, we update all the texts and paint the block in a random color. At the same time, we animate the block moving.
If the offer to receive the bonus is open – either show the bonus or end the game, depending on the choice.
The game menu is also quite simple – we update counters before the start and add events to clicks. At this point this is only a preset.
Add the Plugin to the Game
We create a new game on the panel.
Add the plugin to the game.
Turn off the worker mode in the project settings.
The plugin does not yet support worker mode.
In the plugin settings, add the project ID and public token.
You can see them in the panel.
Add the Advertising
By default, the preloader banner is always shown when loading the game. This option can be disabled in the plugin settings. In my case, in order to exclude the overlapping of banners on each other, I will disable preloader, because the fullscreen will still appear immediately when entering the menu.
Add the sticky banner when entering the menu. It will be added only once and will update itself. As well as, add a fullscreen banner when the entering.
Add a reward for watching a video.
It is important to note, before deciding whether to show the video viewing button, you can check is video available on the platform or not. In our example, if you have already received a reward or the video is not available, then we end the level.
Save the Progress
When completing a level, you need to save the player’progress. By default, the player has variable fields: name, avatar, score. But we need to add number of attempts number of attempts.
Go to control panel. In the Players section, click Add Field and then go to the player settings.
Next, add a new field, and mark it as Stats — now this field is numeric. In the game, we will refer to the field by key. In the example below it is
Add a translation to it.
Mark this field as important so that the player can orient towards it when choosing which progress to save, if it will be necessary.
Now, go back to the Construct. After completing the level, add +1 attempt (1), compare, if accumulated points beat the previous ones (2), then we will save the scored ones (3) and synchronize with the server (4).
Display the Player
Display the player’s best record in the menu, as well as his number of attempts and rating position.
It is important to note that Leaderboard: Get player position is an asynchronous method and it takes time to get the result, so you can wait for it via Wait for previous actions to complete.
Display the Rating
It is easiest thing to display the rating. In the plugin, select the Leaderboard: Open. We will sort it by score, from highest to lowest. Display the top-25 players, including the player on the first place, if he did not get into the leaders. Also display the attempts field in the table to see how many attempts the leaders took to achieve this record.
There will be only one action at the end.
The leaderboard is ready.
The game is ready. In general, such a mini-game affected most of necessary plugin functions. What is more, you do not have to worry about player's saves anymore (especially on IOS and incognito).
An example of game you can see here. And the source is available by link.
Stay in Touch
Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.
For your suggestions
We Wish you Success!