How do I spawn specific numb of enemies randomly periodicall

Get help using Construct 2

Post » Tue Sep 08, 2015 1:11 am

Rampack

So I tried repeating this function for a 2nd object, and I cannot get it to work. I recreated the global values with the new name for the new object, and tried both just recreating the events and actions, as well as just copy pasting, and changing the gv's and sprites, and the 2nd object will not spawn. Any idea what I may be doing wrong? I also tried using a different spawn sprite just to see if that was it for some reason, which it wasnt.
B
9
S
1
Posts: 49
Reputation: 551

Post » Tue Sep 08, 2015 6:59 am

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Sep 09, 2015 2:33 am

Ram, you have me very confused now lol. So, I see where your gameplay spawns 2 different types of units, but I don't see separate code for the 2nd unit, or even the sprite for it anywhere.

After looking more, I see how it has something to do with the alientype command you have built in, but im pretty lost on how you are using that function.

In my case here, I have currently (and may have more in the future as I expand) 3 different sprites I want to be able to spawn from these points, and like the one you already helped me with, I want to be able to set their own spawn number, and spawn frequency.
B
9
S
1
Posts: 49
Reputation: 551

Post » Wed Sep 09, 2015 6:38 am

The 4 different types of aliens are just the frames in the sprites animation . Every time you click the "next wave button" (spButtonRestart) in event 4 it adds 1 to the gvAlienType and this is used to set animation frame after the alien sprite (spAlien) is spawned from a random spSpawnPoint in event 2.

the sprite for spAlien consists of 4 frames each with a different alien graphic - animation speed set to 0.

The spawn number and frequency are also set in event 4 ( global variables - gvNumberOfAliens and gvDelayPerAlienSpawn)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Sep 09, 2015 11:37 am

Ok I get it. How about actually setting in this case, each animation frame to have different spawn numbers, and different spawn frequency.
B
9
S
1
Posts: 49
Reputation: 551

Post » Wed Sep 09, 2015 12:23 pm

That should be easy to do along the lines of set spawn rate= variable*(frame+1) or set alien number=variable(*frame number+1) - just play around with the setting in event 4
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Sep 09, 2015 2:26 pm

Will donly Ram, I'll mess with it some tonight and let you know how it goes. Thanks again.
B
9
S
1
Posts: 49
Reputation: 551

Post » Wed Sep 09, 2015 10:27 pm

I'll test here later tonight but do you think I'll be able to have them set to spawn at the same time? So object 1 will have a random spawn between say 6 to 8 seconds, object 2 random spawn 4,6 seconds, and objectives 3 2, 4 seconds.
B
9
S
1
Posts: 49
Reputation: 551

Post » Sat Sep 12, 2015 7:02 pm

Ram I stuck with the original way of coding you gave me, and got it to work, everything works perfect now!

1 last tweak id like to do if possible. Is there a way, once an object comes out of one of those spawn points, to turn off that specific spawn point for a specific period of time?

Reason why, I think I am having multiple objects fire out of the same spawn at close to the same time, and their collisions are making those objects reflect off and never come on screen, and it's throwing off the obtainable game score. So, object spawns, spawn point waits for 2 seconds before it can be selected as a random spawn point again... or any other clever way to alleviate that problem
B
9
S
1
Posts: 49
Reputation: 551

Post » Sat Sep 12, 2015 7:43 pm

Did a count, my largest asteroid that spawns, game is supposed to spawn 5, only counted 2, I think some of it is from a spawning problem, and other part of it is a separate issue I'm having with mass, these smaller asteroids that have 1/4 the mass, and 1/5 the size, are colliding with, and making the larger asteroids bounce the other way, so I think some are getting turned around before they even enter the actual gameplay field.

Going to have to figure out how to solve that issue.
B
9
S
1
Posts: 49
Reputation: 551

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests