hi there
I have a quick question.
I have a number of enemy sprites which are moving around the screen randomly. they have all been inserted into a group. Is there any way to order the sprites within the group so the sprites with the greatest y position are rendered last. Is there are swap depth function??
I’ve had a quick look on the API’s but haven’t seen anything.
I was thinking this maybe a way to do it. On every frame remove all the sprites from the enemy group and the reinsert them based on there y position. The only way I could figure out how to do this would be to create a depth list of all the enemy’s. Check each enemy’s y position against all the remaining enemy’s. If it has the lowest y value then insert it into the group and remove it from the list and loop through it until the depth list empty. it seems very wasteful and could be very slow. I haven’t coded anything up yet I’m a bit unsure on where to start.
any advice with this would to greatly appreciated. [import]uid: 12378 topic_id: 5122 reply_id: 305122[/import]
[import]uid: 12378 topic_id: 5122 reply_id: 16942[/import]