Enemies on screen help

I have my rules set up like this:
Enemies on screen (attribute) = 9, since thats what is on the first level.
Rule in bullet actor:
When callide or overlap with actor tag enemy -1 from attribute enemies on screen
New rule:
When attribute enemies on screen = 0, then set attribute enemies on screen to 11 and spawn 11 more enemies.
New Rule:
When attribute enemies on screen = 0, then set attribute enemies on screen to 12 and spawn 12 more enemies.
This isn't working once I get to the spawn 12 enemies because it keeps going to the first rule and changing the attribute to 11. Is there another way to set this up so it will work?
Enemies on screen (attribute) = 9, since thats what is on the first level.
Rule in bullet actor:
When callide or overlap with actor tag enemy -1 from attribute enemies on screen
New rule:
When attribute enemies on screen = 0, then set attribute enemies on screen to 11 and spawn 11 more enemies.
New Rule:
When attribute enemies on screen = 0, then set attribute enemies on screen to 12 and spawn 12 more enemies.
This isn't working once I get to the spawn 12 enemies because it keeps going to the first rule and changing the attribute to 11. Is there another way to set this up so it will work?
Comments
Greetings!
If I'm understanding your design objective correctly, you wish to increase the number of enemies spawned with each subsequent round. A new round beginning directly after all the enemies of the previous round were defeated.
As with all things GameSalad, there are several ways you could go about approaching this. Below I've outlined a sample which I believe might achieve your stated goal.
Now, on to the example!
First, you'll want to create another integer attribute. Let's call this one "Round Number", and set the default value to 0. In addition, let's make a boolean attribute called "New Round" and default it to false.
Now we adjust your already existing rule to say:
Rule
When "All" conditions are valid:
"Attribute" "enemies on screen" "=" "0"
(then)
Change Attribute (behavior)
Change Attribute: "Round Number" to "Round Number+1"
Change Attribute (behavior)
Change Attribute: "New Round" to "true"
From there, simply create a series of rules that consider the current round number. An example of this would be:
Rule
When "All" conditions are valid:
"Attribute" "Round Number" "=" "1"
"Attribute" "New Round" "=" "True"
(then)
Spawn Actor (behavior)
Actor: (Your desired enemy actor should go here. You'll need to customize this rule somewhat to make sure it spawns the desired number).
Change Attribute (behavior)
"Attribute" "New Round" "=" "False"
So now what we have is a set of rules and behaviors that keep track of the current round, and spawns the correct number of enemies accordingly.
From here, you'll need to create a rule per each round, and specify how many enemies should be spawned during that round.
The next round might look something like:
Rule
When "All" conditions are valid:
"Attribute" "Round Number" "=" "2"
"Attribute" "New Round" "=" "True"
(then)
Spawn Actor (behavior)
Actor: (this time, customize some additional rules to set a higher number of spawns than the previous round)
Change Attribute (behavior)
"Attribute" "New Round" "=" "False"
This was just one example, and keep in mind that there's countless other ways to achieve your design goals using GameSalad. We hope that the above helps set you down a path that works for you, and we wish you the best of luck with your project!