How do I handle a perk system?

Get help using Construct 2

Post » Sat Jun 21, 2014 4:56 pm

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!
B
7
S
2
Posts: 51
Reputation: 627

Post » Mon Jun 23, 2014 12:09 am

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.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Mon Jun 23, 2014 12:15 am

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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223, PROxMTswatTR, Yahoo [Bot] and 31 guests