Hey,
I'm trying to figure out a monster spawning method, where on condition the Spawner sprite creates monsters (based on its variables) at one of its specific image points.
Question is, how could I simplify this with a Monster family and not repeat the event for each monster type...
Not sure how to pass the moster type to the spawning function... Should I repeat a condition for each Monster there? Or there is a more elegant simplification?
Thank You!
Hi, I'm a little late, but better late than never :D.
As I understand your problem, you have an indefinite number of monsters that appear randomly within certain parameters, and you want to simplify the process. Well, what I did was create an 8x8 spritesheet with a total of 64 monsters, and I put them all within a single sprite (although you could also use a family). Then I stopped the animation (value 0) and told the mouse that when you click each sprite (SingleMonsterBox), it should spawn a monster sprite and randomly select a frame from within the range of 0 to the total number of frames.
With the MultiMonsterBox sprite, this is a single sprite with 7 image points. The same thing happens, except here I run a "for" loop with a loop index, telling it to iterate through the maximum number of image points and place a monster sprite at each one.
I hope this method simplifies things for you and is useful for your project or a future one. Learning new things is always great.
DEMO:https://demomonsterspawner.netlify.app/
.CAPX:https://www.mediafire.com/file/7ybyrfqvsh76x85/demomonsterspawner.capx/file