multiple instances spawning at multiple places
Alright, so I've got an enemy object, an enemy spawner object, and an object that's the resolution of the window and follows the window at all times. My previous way to spawn enemies was when the spawner overlaps the screen, and there are no enemies on screen, create an enemy. This has allowed for one enemy of each type, but now I want more.
If there are two instances of spawners, I want each to be able to create one enemy when it comes on screen, instead of one spawner creating two. I want to do all this with multiple instances.
So, is there a good way? I know how to do stuff like fastloops with spread values, but thinking about this situation makes my head hurt.
Re: multiple instances spawning at multiple places
you could do this,
[color:#FF0000]if spawner overlaps screen
no enemies on screen[/color]
[color:#33FF33]spread value 1 to Alterable Value A (spawner).[/color]
[color:#FF0000]If Alterable Value A is greater than or equal to one[/color]
[color:#33FF33]turn flag 0 on.
Set Alterable Value A to 0[/color]
[color:#FF0000]If flag 0 is on[/color]
[color:#33FF33]create enemy at (wherever you want the enemy to be created)
turn flag 0 off
only one action when event loops[/color]
if this does not give the disired effect, then check out Angelfox's mario bros. example and look at the group named block. if u look closely, i think that can explain how to do it
Re: multiple instances spawning at multiple places
Nah, that isn't working because it's only doing it when there are no enemies on screen. I want it so that even if enemy 1 is on screen, spawner 2 can still create enemy 2.
The Mario Bros. example didn't help either.
Re: multiple instances spawning at multiple places
then change
[color:#FF0000]if spawner overlaps screen
no enemies on screen[/color]
[color:#33FF33]spread value 1 to Alterable Value A (spawner).[/color]
to
[color:#663366]if spawner overlaps screen[/color]
[color:#3333FF]enemies on the screen is less than or equal to 1
spread value 1 to Alterable Value A (spawner).[/color]
then just put in the rest of the events for your code
did this help you?
Re: multiple instances spawning at multiple places
No, because I want it to happen no matter how many enemies are on screen.
Re: multiple instances spawning at multiple places
then do this
[color:#990000]if spawner overlaps screen[/color]
[color:#663366]spread value 1 to alterable value a (spawner).
Restrict Actions (how ever many seconds you want the enemies to spawn).[/color]
this is if you want the spawners to continously spawn enemies.
[color:#FF0000]if spawner overlaps screen
flag 1 if off[/color]
[color:#3333FF]spread value 1 to alterable value a (spwaner).[/color]
[color:#990000]If Alterable Value A is greater than or equal to one[/color]
[color:#3333FF]turn flag 0 on.
Set Alterable Value A to 0[/color]
[color:#CC0000]If flag 0 is on[/color]
[color:#000099]create enemy at (wherever you want the enemy to be created)
turn flag 0 off
turn flag 1 on
only one action when event loops[/color]
this is if you want the spawner to spawn enemies only once.
did this work?
if not, then explain to me EXACTLY what you want the spawners to do when they are onscreen
Re: multiple instances spawning at multiple places
Eh, this is working a little better, but it still has problems.
Say two enemy spawners are on screen, each one made an enemy. Now both of the enemies go off screen, so both are destroyed. If you go to a point where spawner 1 is off screen and then go back, another enemy should be created. But, since spawner 2 had been on screen the whole time, no enemies are created.
It needs to check if that spawner's enemy has been destroyed or not.
Re: multiple instances spawning at multiple places
you could do
[color:#FF0000]if enemy x position of less than the x left visible edge of screen[/color]
[color:#3366FF]destroy enemy[/color]
[color:#FF0000]if enemy x position of greater than the x right visible edge of screen[/color]
[color:#3366FF]destroy enemy[/color]
[color:#FF0000]if enemy y position of less than the y top visible edge of screen[/color]
[color:#3366FF]destroy enemy[/color]
[color:#FF0000]if enemy position of less than the y bottom visible edge of screen[/color]
[color:#3366FF]destroy enemy[/color]
you could put all of these into one condition using the or function.
you could also try doing the events that i said in the previous post, but make it specific to each spawner.
if this doesnt fix the problem, then tell me what is happening when you run the frame.
Re: multiple instances spawning at multiple places
Alright, now I've got each spawner to create an enemy when it comes on screen, and I have the enemies set to be destroyed when they go off screen. I set it so that if a specific spawner goes off screen, its flag 1 goes back off (using fastloops and another id).
However, if I spawn both enemy 1 and enemy 2, then scroll until spawner 2 is off screen, then scroll back until it's on screen, it'll create a third enemy. So I still need it to check if its specific enemy has been destroyed. I only want one enemy from each spawner to exist at any given time.
Re: multiple instances spawning at multiple places
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=129541&#Post129 541
Re: multiple instances spawning at multiple places
plz explain to me what the specific problem is
Re: multiple instances spawning at multiple places
Well, if a different enemy is on the screen too, the filtering seems to not work.
Re: multiple instances spawning at multiple places
Re: multiple instances spawning at multiple places
Re: multiple instances spawning at multiple places
demo version ran out, cant open any more mmf2 documents.
i have a question though. lets says i install mmf2 on my cpu and the demo ran out.
if i were to install the hwa version, could i get another 30 days?
Re: multiple instances spawning at multiple places
I hated when that happened to me. I was right in the middle of doing something. But then I bought the actual version and continued the project. To install the regular version, you need to unistall the demo. I don't think you can install updates or betas on the demo version
Re: multiple instances spawning at multiple places
So no one knows of a way to do this? I need to identify which spawner created which enemy, and if that spawner's enemy still exists, it needs to not create a new one.
Re: multiple instances spawning at multiple places
yes i think you can.
when u do the event that creates the enemy, do spread value of 1.
if u were to add up the totals, they should equal 3. try and find a way to add the alterale values of the same enemy. if they equal 3, then no enemies are needed. if it equals one, spawner 2 needs to create an enemy. if it equals 2, spawner one needs to create an a enemy.