How do I store local co-op RPG elements

Get help using Construct 2

Post » Tue Mar 29, 2016 3:41 pm

I'm creating a local co-op RPG game, up to 4 players can choose from up to 10 characters (each with their own move sets) I need to store/persist player variables like:
-Level
-Character Name
-XP
-Money
-Base Health
-Base Damage
-Ability 1 Level
-Ability 1 upgrades
-Ability 2 level
-Ability 2 upgrades
-Ability 3 level
-Ability 3 upgrades
-Ability 4 level
-Ability 4 upgrades
-Armor Piece 1
-Armor Piece 2
-Armor Piece 3
-Armor Piece 4
-Armor Piece 5


and probably more that I cant think of. Should I make 1 array to store all this information for all 4 players, 1 array per player, or 1 array per character? I need them to persist through layouts, and I might possibly need them to save between play sessions as well.
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Tue Mar 29, 2016 4:39 pm

If i understand it right, i would try making an array for each player and then when it comes time to play or make a new game with the player just have a function to call for when a specific character is chosen and then populate the array based on that so that you would be dealing with 4 array instead of ten array and having to erase them every time.

And then for the rest If i remember right there are some value that should be stored in array and then in dictionary. Not sure what is best used. Im working on a system myself but its just for one character atm. as for persist you can just set the array to global. Saving the game is one area i have no explored yet.
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Tue Mar 29, 2016 4:47 pm

Gearworkdragon wrote:If i understand it right, i would try making an array for each player and then when it comes time to play or make a new game with the player just have a function to call for when a specific character is chosen and then populate the array based on that so that you would be dealing with 4 array instead of ten array and having to erase them every time.

And then for the rest If i remember right there are some value that should be stored in array and then in dictionary. Not sure what is best used. Im working on a system myself but its just for one character atm. as for persist you can just set the array to global. Saving the game is one area i have no explored yet.


thanks! That's what I'll do then! I'll do a player 1-4 array. And assign the player's variables on each start of the screen based off of the global array.
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Tue Mar 29, 2016 6:01 pm

If all four players have the same amounts/types of information, I would just use a single array. But that depends on how comfortable you are using arrays and their expressions I suppose. It could compact your event sheet significantly, but at the same time make it harder to read or understand.
Mistakes were made.
B
52
S
26
G
110
Posts: 1,620
Reputation: 62,161


Return to How do I....?

Who is online

Users browsing this forum: Kin, mickclarke, mikehive, tinhofiel, totoe, TRMG and 45 guests