Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
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'.
Develop games in your browser. Powerful, performant & highly capable.
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!!
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'.