Hi. I need some help with my character selection.
what happens is that i have a main charater in display on level 1 layout (destroyed on layout start). that character (and all of them) are moving with touch, so when i touch its position is where i touch and if a drag the finger, the main character follow my finger.
the problem comes when i have several characters (1,2,3...) to choose. i made a global variable with so many values, each value is a character, but now, how do i spawn once the character i selected where i touch? because meanwhile the global variable is 2 for example, (because i selected that character), it's a non stop character selected spawning, every where i touch it creates a character and when finger moves it leaves a path full of the character i selected.
how can i make it work like the main character?
i thought of putting every single characetr on level one and then destoy them on layout start, but wouldnt it take ages to load that level? there are like 50 characters to choose..
how can i fix this. help-
Develop games in your browser. Powerful, performant & highly capable.
Sounds like you need to add in a secondary check to your script.
Without seeing it I can't be 100% sure but from what you have said It seems the easiest way would be to add some more global variables and use them like booleans (true/false checks).
When you run your character creation function, add in a check to see if your new variable is = to 0, if it is, then run the creation script.
So, when you spawn a character you'd then have something like an "On Sprite Created" check and then set the secondary variable from 0 to 1 (for True) so that you're only spawning that character once.