Best way to handle multiple stats

0 favourites
  • 6 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hello there !

    I'm planning to make a kind of zelda like(old school) with bunch of stats and many players(you pick one at the start of the game and can't change after).

    I've read multiple topics about it ,most talk about instance variable and others said instance variable is not the way because it is destroyed when the player is too(death i.e).

    For example if I have to set Value like HP,stamina,exp,level,def(base value) and other stats like this influenced by equipement find in game ,what is the most efficient way to do?

    Of course the game can be saved.

  • I would use instance variables on a player-family. Never destroy players, just disable and hide them if they die, etc.

    Secondly you could store the stats in an array or dictonary and load them into the instance variables on re-spawn. Only in case you really really see the need to destroy the player object.

  • Well ,the player will never be destroyed(easier I think),he will have the choice to load the last save or not(in this case the game close).

    I've read everywhere to use global variable or dictionary.I've tried the second one few minute ago and find it confusiong for the moment.

    If I read right i have to use dictionnary editor(created in file folder)+had to create dictionnary in object but this one is empty and can't be fill except by instance variable.

    Not sure what is the easiest,I'm a totally noob =p

  • If you use constructs build-in save system https://www.construct.net/en/tutorials/savegames-313, there is no need to save to a dictonary or array.

    I would just use instance variables and let construct do the saving.

    With global variables you would need new ones per player and then pick the correct ones in functions. With instance variables you don't have that problem.

  • I will try it with a build because the game is intended for use on steam ^^

    The tutorial only talk about game used trough browser.Have you yourself use this with a construct build for desktop?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have tried it, and I don't think there is a real difference as Windows-builds still run in Chromium/Edge webview 2, So it's still basically a Browser.

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