Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I thought "count" would do it but when I use Array.Count on my array, which is 50 wide but have 5 elements filled, it returns 1. (???) and "count" isn't actually documented on the manual page so I have no idea wtf it's supposed to do.
I guess I could use Array.Width but looping through a ton of empty space seems like a waste of computing power...?
The count expression gives the number of that object type. It's documented in the common aces section of the manual.
A loop checking how many are filled or a variable that you update as you fill the array are both good options. The loop is simple and the variable way while faster will be easier to mess up.
Common Conditions, Common Actions and Common Expressions have there own page in the manual.
A ton of empty space is a heartless waste of computer memory.
But, i suspect that you use 'zero' as a value, hence, they are not even 'empty'.
Oh ok, I didn't know Count was not an array-exclusive thing! I usually see "count" as array length in other languages
I found the best way for my situation was to have a variable that updates each time I add to the array. Thank you for the solutions!!
Develop games in your browser. Powerful, performant & highly capable.
Start with a (0,1,1) array. If you only need the X-axis. Push new values to it, to keep the array from 'wasting'.