I've created a function in my game to arrange a bunch of sprites, representing cards, into a column, laying them out so each is on top of the other going down the screen. I'm sure I had it working some time ago, but since I've been sorting out some other issues it would appear I've changed something so now it's not working. but I can't figure out for the life of me why!
within the function, it selects sprites based on a variable (set before calling the function), then runs a for each loop ordered by another variable. The actions within the for each loop are to set the sprites to a position based on a formula using the loopindex, and then to move the sprite to the top of the layer. The positioning part is working perfectly, so if a card with a lower value is added, it is put in the appropriate place in the column, but it doesn't seem to be rearranging the Z order, it's just leaving them in the order that they were created. I know this should work as I have an almost identical function, used on another layout, that is working properly, and as I said, I'm sure this one was working properly before!
Here's my files. the function is called ArrangeDeck and is on the PS-Deckbuilder sheet. The action to call the function is a few events above it.
Any help would be much appreciated, thanks!