Proper use of arrays? Weapons, Inventory, tileset, etc...

Get help using Construct 2

Post » Thu Feb 18, 2016 12:29 am

Do you guys typically use one array to store one type of item such as weapons? Or do you stack multiple types all into one array such as weapons, inventory, tileset, powerups, etc...?

If you do use one array, do you use a token to split between different types?

Weapon 0 1 2 3 4 5 | Inventory 0 1 2 3 4 5 6 7 8 9 | tileset 0 1 2 3 4 5 6 etc...
Check out my games on Google Play:
BEAST ATTACK (1,000,000+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
54
S
18
G
2
Posts: 436
Reputation: 5,582

Post » Thu Feb 18, 2016 1:22 am

It really is up to you. General tip is to not try to put too much information all in the same array, or it may get harder to manipulate/access the information you want. But other than that use whatever organization system makes sense to you.

A big consideration for me is usually that you can only use IndexOf on the X axis of any given array.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458


Return to How do I....?

Who is online

Users browsing this forum: David181 and 26 guests