Player Stats

About

This template expands your game with a stats system allowing your player to see his progress. Also he / she can achieve ingame medals. The names are localised, so you can manage diffrent languages easily. To get help with the language stuff, please see this documentation.

Download

You can download the template at scirra.com

  Player Stats

Screenshots

Medals detail view called when the user clicks any medal. All currently unlocked medals and their name and progress.

Demo

You also can play the demo available on Scirra Arcade.

Player Stats (Demo)

Used addons

All used plugins are available for free, you’ll find those also included in the package. Here is a list showing all used addons.

Plugins

For the both plugins board and square tx, made by rexrainbow, I recommend you to use his plugin / behavior download tool. Find out more here.

Behaviors

Functions

Here you find all information for the used functions.

Stats

All stats relevant functions.

Stats.Add()

Parameter

  • Param(0): StatsKey (string)
  • Param(1): Value to be added (int)

This function will add the passed value (Param(1)) to the passed state key (Param(0)). Afterwards the stats dictionary will be saved to the LocalStorage automatically.

Stats.setHighest()

Parameter

  • Param(0): StatsKey (string)
  • Param(1): Value to be set as highest (int)

This function will set the value of the passed stats key (Param(0)) only to the passed value (Param(1)) if this passed value is higher than the currently stored one. This fits the most for HighScores or highest reached level. Afterwards the stats dictionary will be saved to the LocalStorage automatically.

Stats.InitBoard()

Parameter

  • none

This function will be called automatically, there is no need to call this function. However it inits the size of the grid for the medal view window.

Stats.GetMedal()

Parameter

  • Param(0): stats key (string)

This function will returned the highest achieved medal for the passed stats key (Param(0)). Following return values are possible.

Return values

  • 0 = no medal achieved yet
  • 1 = bronze
  • 2 = silver
  • 3 = gold

The medal animation frame will then be set to the returned medal (0 based index).

Stats.GetNextTarget()

Parameters

  • Param(0): stats key (string)
  • Param(1): current medal (int, 0-based index)

This function will return the next target to unlock the next medal. This function will be used to display the next target for the detail view window.

Return value

  • int, next target to reach

 

Stats.Show()

Parameter

  • none

This function will show the panel with the currently unlocked medals. Moreover the current amount for each medal, as well as the name, are displayed.

 

Updated on May 2, 2018

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Privacy Preferences

Strictly Necessary

Cookies that are necessary for the site to function properly.

gdpr,PYPF, woocommerce_cart_hash, woocommerce_items_in_cart, _wp_wocommerce_session,gaoop_hide_info,cookieconsent_dismissed, wordpress_,'g-recaptcha-response

Google Adsense (Google Inc.)

We are using Google AdSense to show personalized ads on our webpage and our forum. For more information see the privacy policy by Google.
https://www.google.com/policies/technologies/ads/

Doubleclick, __gads, __gac