Hi!
My game consists of 10 different characters (sprites). How do I get them to appear randomly but no more than 5 sprites at a time on my game layer at a time?
-alex
A fast, easy to use, free, and community supported 2D game engine
Hi!
My game consists of 10 different characters (sprites). How do I get them to appear randomly but no more than 5 sprites at a time on my game layer at a time?
-alex
The simplest solution a can think right now would be:
in your method that, let's say, adds an sprite each second, count the current quantity of objects and if the count is less than 5, add an sprite, else, don't.
In the method that removes an sprite you should lower the count of objects.
If you have the objects in an array its only a matter of counting its elements before adding a new one.
My sprites would have to already be there at the opening of the scene. And with each opening of that scene a different selection of sprites would need to be there.
???
You must log in to post.