How do I handle a perk system?

  • I'm implementing perks into my game and was wondering whether the should be handled by an instance variable, local or global variable.

    Players earn points which they can spend on perks between levels. Atm, when player picks a perk, an instance variable (boolean) gets toggled on the player object. On restart (after death or on new game) the IV's get reset to false.

    Is this the best way? Would it be better to handle perks with LV/GV's? would it even make a difference at all?

    Just curious!

    Thanks!

  • If you're making something that's with player through the whole game, global variables are the way to go. I'm not very experienced with them, but I belive local variables are better for single layouts.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Depends on whether you want the perks to persist between games. Do you save game state already? If the player object is not destroyed between levels, you could use instance variables. If the player is destroyed then you would want global variables or static local variables. Or you could use an Array and save to a JSON file, then re-load it each game.

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