
So, relatively vague title, and I'm going to provide relatively little to go on cause I don't want to post tons of my amateur code and try to explain whats going on (at least not for now).
I'm making a kind of puzzle game that involves pieces that move on their own based on certain attributes. Two of my main functions are a "trackMoves" and a "collisionCheck". When the movement tracker detects that an object has run out of a certain attribute, it's supposed to erase it and remove it from a master array of "allRealizedObjects" before passing that array to the collision checker to see if any objects occupy the same position.
My problem right now is that the array of objects seems to change when its passed from one function to the next, even though there shouldn't be anything modifying the array in between. My log looks like this:
"removeSpent allRealized fires"
"allRealizedObj.length at track moves0"
"collisionCheck fires"
"allRealizedObj.length at collisionCheck2"
I don't know what's going on. Hence, I am confounded. I've tried rejiggering things and if I put the "removeSpent" function at the beginning of "collisionCheck" instead of the end of "trackMoves" then the array turns out correct but there are new problems. I'm a VERY amateur coder and I'm pretty stuck on this after enjoying some mild success making my scripts work. Any suggestions are appreciated, I can post more info or direct you to the github that my data-engineer little brother helped me set up!
I'm making a kind of puzzle game that involves pieces that move on their own based on certain attributes. Two of my main functions are a "trackMoves" and a "collisionCheck". When the movement tracker detects that an object has run out of a certain attribute, it's supposed to erase it and remove it from a master array of "allRealizedObjects" before passing that array to the collision checker to see if any objects occupy the same position.
My problem right now is that the array of objects seems to change when its passed from one function to the next, even though there shouldn't be anything modifying the array in between. My log looks like this:
"removeSpent allRealized fires"
"allRealizedObj.length at track moves0"
"collisionCheck fires"
"allRealizedObj.length at collisionCheck2"
I don't know what's going on. Hence, I am confounded. I've tried rejiggering things and if I put the "removeSpent" function at the beginning of "collisionCheck" instead of the end of "trackMoves" then the array turns out correct but there are new problems. I'm a VERY amateur coder and I'm pretty stuck on this after enjoying some mild success making my scripts work. Any suggestions are appreciated, I can post more info or direct you to the github that my data-engineer little brother helped me set up!