How do I properly track player statistics?

0 favourites
  • 2 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hey all, just kind of playing around making simple games at the moment, and was wondering about player stats.

    If I have a party-based game, with a few characters controlled by the main player, what is the best way to track their stats?

    For example, if I have two characters with some stats:

    Health

    Resource

    Strength

    Speed

    etc.

    What is the best way to track these stats? I would need them to calculate when battle occurs, as well as when not in a state of battle, to see interactions with items that can be equipped, as well as using items in inventory to affect these stats (think health potions or perhaps speed potions). I would want to be aware of their values throughout the game. From my past programming experience (limited as it is) I know that having a ton of global variables isn't usually a good idea.

    I know that one approach to tracking enemy stats is to use families because they won't be used outside of a combat instance, but I don't think this would work for what I am doing.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could use instance variables. (If you select one of your characters in the properties panel you can add the instance variable.)

    So each instance of an object has its own copy of the variable and keeps track of the value. (When you assign an instance variable to a family each instance of that family member keeps track of its own value.)

    The only thing is if the instance is destroyed the values are lost. So if you want to keep the values for beyond the life of the instance you would want to use either an Array or a Dictionary.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)