About
This documentation is for our Player Selection Template (for the version with an array and InApp Purchase).
[creativ_button url=”https://www.scirra.com/store/royalty-free-game-templates/game-template-9-player-select-1040″ icon=”heart” label=”Player Selection (Construct 2 Template)” colour=”red” colour_custom=”” size=”medium” edge=”rounded” target=”_blank”]
Additional Plugin
In App Purchase
The template offers the opportunity to unlock certain players (expected player 1, this player is always free) via InApp Purchase. To configurate this feature please head over to your Google Play Developer Console.
[creativ_button url=”https://play.google.com/apps/publish/” icon=”heart” label=”Google Play Developer Console” colour=”blue” colour_custom=”” size=”medium” edge=”rounded” target=”_blank”]
Then select your App (you must have an apk file uploaded first) and eventually click on the In-App Products Tab (in German: In-App Produkte) and click on + Add new Product.
Selected ‘managed product‘.
Format for the ID’s
[code]iapplayer_2 //ID for unlocking Player 2
iapplayer_3 //ID for unlocking Player 3
iapplayer_X //ID for unlocking Player X
[/code]
Add one ID for all available players minus 1 (due the fact that player 1 is always unlocked!).
Select Prices
It’s important to add the set prices also in your C2 Project. In order to do this open the es_menu (or es_start) event sheet and search for the PriceInDollar variable (header).
This is a list of all prices separated by a comma.
[code]PriceInDollar = 0,0.79,1.49 // the prices are ordered. First price is for player 1, second for player 2 and so on.[/code]
Note: The same order applies for the PriceInCoins variable.
So if you want to change the price for player to, change the 0.79 (on place two in the variable) to another price (make sure the prices matches with the prices set in Google Play Dev. Console).
Add more Players
Go to the “es_menu” event sheet. There you find the shown variables.
- AvailablePlayers: Set this to the player count you wish (note, check also the “Players” & “Unlocks” array’s width. The widht must be equal or greater than the “AvailablePlayer” count)
- PriceInDollars: Add the price for each player here. Additionally you can fetch the prices from the Google Play Store, but this needs customization of the template. (note, first must be 0.)
- PriceInCoins: Same applies here as with the PriceInDollars variable. Insert the prices in coins for the players. (note, first must be 0.)
- PlayerInitialState: Here can you adjust, with players are unlocked from default.