Cocoon.io и подключение Leaderboard от Play Games Services

1

Stats

5,315 visits, 9,097 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Since new service Cocoon.io cloud compiling from Ludei started we have the chance to connect plugins from the Cordova to our Construct 2 mobile applications.

In this tutorial we plug Leaderboard from Google Play Games.

Donwnload Cocoon plugins for Construct 2.

This plugin you can use for AdMob and MoPub integration in your application too. Notice that this plugin has objects for sharing, social intergration and in-app purchases. But in this tutorial we will talk about leaderboard only.

There are detailed documentation about objects and function of this plugin on GitHub project of plugin. The PATH for plugin in Construct 2 directory: CONSTRUCT_2_INSTALLATION_FOLDER\exporters\html5\plugins. Не забудьте перезагрузить Construct 2.

Insert the object Cocoon Google Play Games in yout project:

Insert action (function) Request Login of Cocoon Google Play Games :

You can insert this action in listing of actions of event handler, but you can put it in anywhere in your code by your choice, for example, in listing actions of on start of layout event, and you will plug to services automatically in the background mode.

The object has two events: on login success and on login failed. You can "hang" event handlers on these events if you need have response for these events:

You can see the result of logging on the screenshots:

We will use actions Submit Score, Request Player Score, Open Leaderboard for to deal with Leaderboard:

You have to create the Game Services in Google Play Developer Console and connect your game/app to it. You can connect apps/games in alpha, beta and release modes. You have to create the Leaderboard in your Game Services. Every Game Services game connections and Leaderboard have identifiers, which we will use for argument for plugin in Cocoon.io cloud compiler and as argument in actions of Google Play Games plugin in Construct 2:

When you have player score in your game and you want put it in Leaderboard you call action Submit Score. This action has two parameters: Score and Leaderboard (identifier of Leaderboard):

If you want to show the Leaderboard result to your player you call action Open Leaderboard with one argument... Yes, it is the identifier of Leaderboard in your Developer Console Game Services. :)

Result of actiion calling:

At last you must export your game with Mobile Cordova icon selected. Pack your game in *.zip archive, upload it on Cocoon.io cloud compiler and select suitable plugin Google Play Games Social API. You have to insert your Game Services Game Connection identifier as argument for plugin (bottom right). Be carefull: the Leaderboard and Game Services identifiers are different:

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!