Hello
I'm actually working on a game where I can throw swords in the walls and use them as a ladder in a 2d side view plateformer.
I want my character to be able to stuck like 10 swords maximum at a time. So when he throw the 11th, the first one (the oldest) that he threw is destroyed. Same goes for the 12th (destroying the 2nd) etc...
For the sake of clarity there is one sprite (of a whole sword) that is thrown using the mouse click by the player. And when the sword collide with a wall, it get stucked, turn invisible and I spawn a different sprite of a sword stuck hallfway throught at the same position and angle.
I already made a global variables that track each time a SwordStuck sprite is created to keep track of the number of sword for my player (because all the flying sword arent mandatory to end in a wall, so I d rather track the sword planted in the wall are thoses are the ones I want to limit).
I tried different solutions using chatgpt, looking for answer in forums and asking friends of mine, and I can't seems to managed to delete the oldest instances.
Thanks a lot for the help
sorry for the grammar, english isn t my first language.