Instance variable type: array

Discussion and feedback on Construct 2

Post » Wed Oct 10, 2012 10:16 am

What do you think?

It could be useful to store a set of values in the instance variable.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Sat Dec 30, 2017 10:35 am

This
B
6
S
2
G
1
Posts: 34
Reputation: 1,101

Post » Sat Dec 30, 2017 12:35 pm

all Instance variable is the same no matter the type of Object.... array, sprite, text etc all the same Instance variable
Image
B
49
S
15
G
2
Posts: 350
Reputation: 4,502

Post » Sat Dec 30, 2017 12:43 pm

This is supported in Containers.
A big fan of JavaScript. Image Image
B
76
S
20
G
81
Posts: 2,347
Reputation: 50,188

Post » Sat Dec 30, 2017 1:59 pm

You can also use instance variable to store array's UID.
Add a couple of helper functions for setting/getting values in array by its UID and voilà - you have your array in instance variable.
B
17
S
9
G
104
Posts: 1,481
Reputation: 56,031

Post » Sat Dec 30, 2017 2:43 pm

Having an array as a primitive variable type instead of a separate object would be nice. It would make things more readable. As is picking and functions can make it look complicated and/or make things more complicated. Don’t get me wrong, picking is pretty nifty for many things but is an awkward replacement for some logic.
B
94
S
33
G
125
Posts: 5,458
Reputation: 79,979


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests