http://www.blackhornettechnologies.com/Construct3Stuff/Samples/ArrayInventory_VertexZero.zip
I think one issue was that you were resetting on delete to a valid slot id (0). I've changed it to start at -1 to indicate empty, and added a function that searches the array for the first empty slot.
Develop games in your browser. Powerful, performant & highly capable.
Oh so that would explain the weird behavior ( if creating first item and then deleting would send me at the end of the array ) among other things.
Thanks!
is it -1 similar to when you write array.Width - 1?
— & blackhornet thank you guys!!!
Width-1: no, this is something else. It's a common mistake. Indexes start a 0, so you have to count that as "1" when looping. That is, if the array is 8 wide, you don't want to loop from 0 to 8, you want to loop from 0 to 7!
ahhh damn... rookie mistake! Thanks for your help and the info. :)