multiple variables or array?

Get help using Construct 2

Post » Sat Nov 12, 2016 8:17 pm

Kyatric wrote:Having an array to hold "initialisation variables" per phase sounds correct as well.
In fact, you would pick the value from the array on creation of the enemy and fill their instance variable with it, accordingly to the current phase (you would then use an array with at least two dimensions, X being the phase, Y being each of the variables required).
To store those kind of data, an array is one of the available data structure.


Yeah, that's what I thought. I know the performance would not change anything, just wanted to make it organized. After many tests I kept the variables on each enemy and created global variables to do the updates. And for me not to get lost in the future I created an event just for the variables of the enemies.

Thank you for your help. :D :D
Hi I am Samuel :)

My google play
B
42
S
10
G
1
Posts: 126
Reputation: 3,278

Post » Sat Nov 12, 2016 11:24 pm

Kyatric wrote:Having an array to hold "initialisation variables" per phase sounds correct as well.
In fact, you would pick the value from the array on creation of the enemy and fill their instance variable with it, accordingly to the current phase (you would then use an array with at least two dimensions, X being the phase, Y being each of the variables required).
To store those kind of data, an array is one of the available data structure.


Are there any good array tutorials you'd recommend? I'm looking back into tutorials in order to figure out save data and usage of arrays. I could never find a good array tutorial video. And your tutorials are great, so... make more? Thanks :lol:
B
216
S
119
G
8
Posts: 141
Reputation: 21,458

Post » Tue Nov 15, 2016 10:13 am

@YoHoho: Thanks.
I often use arrays within my tutorials, but I don't have a dedicated tutorial for arrays, or a tutorial that uses the array in such a way as described in this topic.
I have made several capx examples in the past, they surely can be found in the How do I FAQ probably in the "Array" category, but no video tutorial I can remember of at this time.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,293
Reputation: 70,769

Previous

Return to How do I....?

Who is online

Users browsing this forum: beohs, tunepunk and 10 guests