Posted By
|
Message
|
J.C
Registered 22/03/2013 05:18:14
Points 118
|
8th September, 2014 at 08/09/2014 18:41:26 -
For my most recent project, I've been trying to figure out how to limit the number of enemies onscreen. I have a boss fight where the boss summons minions to attack the player. I seem to be having trouble getting the code to 'Count' how many spiders there are onscreen. Or count the number of spiders as they spawn.
Here's an open source version of the code for you guys to get a better idea of what I'm trying to accomplish: https://www.dropbox.com/s/fq4xtv8sybef0v4/TestApp.mfa?dl=0
n/a
|
s-m-r Slow-Motion Riot
Registered 04/06/2006
Points 1078
|
8th September, 2014 at 08/09/2014 19:14:36 -
Let's say your limit of enemies onscreen at any one time is 20. Look at the following, and you'll see that this just might be a simple solution for you. I'm looking at event 117 in your example file...
IF Count (Group.Enemies) < 20
+ Always
THEN Subtract 1 from Counter (Mini Spider Counter)
Just add in that one line before "Always" in the conditions, and that should most likely solve it for you.
Please let me know if it works for you, or if we need to think of something else.
n/a
|
J.C
Registered 22/03/2013 05:18:14
Points 118
|
8th September, 2014 at 08/09/2014 20:24:52 -
EDIT: I just modified the file so that the Enemy spawn code appears in its own group at the top of the page.
n/a
|
J.C
Registered 22/03/2013 05:18:14
Points 118
|
10th September, 2014 at 10/09/2014 03:06:52 -
Originally Posted by s-m-rLet's say your limit of enemies onscreen at any one time is 20. Look at the following, and you'll see that this just might be a simple solution for you. I'm looking at event 117 in your example file...
IF Count (Group.Enemies) < 20
+ Always
THEN Subtract 1 from Counter (Mini Spider Counter)
Just add in that one line before "Always" in the conditions, and that should most likely solve it for you.
Please let me know if it works for you, or if we need to think of something else.
It Worked! This technique was simpler than I imagined.
n/a
|
|
|