i want to make side scrolling shooter game. if player get a companion icon, player will get one companion. each ccompanion icon for one companion. i want limit for four companion. first companion will on the top player, the second on the below player, the third on top the first and the fourth on the below the second. Every companion will destroy if hit enemy bullet. Things that make me confused, if the first companion destroy or the third destroy and player once more get the companion icon how to make the new companion replace the companion which is destroyed ?
Develop games in your browser. Powerful, performant & highly capable.
why not do something like this have an invisible sprite in place of where the movement and such should be at. note this invisible sprite would just be always following the player ready to pull in the new companion in the correct spot. Just have the old companion to pin to it and once it destroyed then when you get a new one create the sprite and move it to the invisible sprite and re-pin it.
Thus you don't have to waste coding time trying to find the sweet spot again for the new companion.
also you didn't tell us what style of companion you are doing that might help or even better an image.