How do I stop c2 from spawning way to many enemies at once

Get help using Construct 2

Post » Sun Jan 15, 2017 2:40 pm

hello everyone I have been working on a shmup for about 2 months now and while it has perfect frame rate on the pc I just tested it on the tablet and the fps drops to about 12 fps and I know the reason why it is because I have way to many objects just sitting there on the layout ready to go
Image
so i am trying to make a sprite called the object spawner and it spawn enemies on the fly
Image
But it is spawning WAY to many enemies, It looks like there are just 5 enemies on screen, but when I shoot them the body count (a global variable I use to keep track of how many enemies the player has shoot down so I can bring in the next wave) it says I have shoot down 500 instead of just 5 I added a new global variable called enemy count but that does not seem to help any advice would be appreciated
B
14
S
4
Posts: 125
Reputation: 1,385

Post » Sun Jan 15, 2017 3:30 pm

Try putting a wait=0 between the last set 101 and set 102. I don't think you need the trigger once in the enemy spawn condition since you are controlling it via enemy count #.. you want it to always keep 5 spawned, correct? 3 die it spawns up to 5, repeat?

Also, why so many instances of the same sprite? You could cut your item count dramatically by deleting all identical ones and creating them on the fly from 1 persistent one off screen.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Sun Jan 15, 2017 3:38 pm

Move the Set state to 102 to the top, rather than the bottom. It's taking 2.5 seconds to reach that line, that is stopping your spawn code. (The Trigger once in event 30 is't going to work.)
Last edited by blackhornet on Sun Jan 15, 2017 5:25 pm, edited 1 time in total.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sun Jan 15, 2017 5:06 pm

chrisinfinger wrote:Try putting a wait=0 between the last set 101 and set 102. I don't think you need the trigger once in the enemy spawn condition since you are controlling it via enemy count #.. you want it to always keep 5 spawned, correct? 3 die it spawns up to 5, repeat?

Also, why so many instances of the same sprite? You could cut your item count dramatically by deleting all identical ones and creating them on the fly from 1 persistent one off screen.


the image i posted was to show what I wanted to change I was hoping to delete all those sprites and only have 1 of each enemy type on the layout
the idea was to spawn just 5 once the bodycount reaches 5 the object spawner would change state which would spawn the next wave of enemies.

blackhornet wrote:Move the [b]Set state to 102[.b] to the top, rather than the bottom. It's taking 2.5 seconds to reach that line, that is stopping your spawn code. (The Trigger once in event 30 is't going to work.)

I tried putting the state change line up top still did'nt help C2 still seems to be creating 100 enemies at a time :(
B
14
S
4
Posts: 125
Reputation: 1,385

Post » Sun Jan 15, 2017 8:09 pm

solved it, I just had to make a separate state for every enemy now I just need to spend an evening making all the states for every enemy in the game slow and tedious work, but being able to play my game at 50 fps on a tablet will make it worth while
Image
B
14
S
4
Posts: 125
Reputation: 1,385

Post » Sun Jan 15, 2017 11:06 pm

Hello @PrinceofMars , sorry for bothering you on a solved post, I'm developing a shmup too, bullet hell genre to be precise, and i got curious while looking at you wave events, do you mind spending a few words to tell me how you managed the wave system ? :)
Image
B
21
S
7
G
3
Posts: 32
Reputation: 2,977

Post » Mon Jan 16, 2017 4:47 pm

pokka wrote:Hello @PrinceofMars , sorry for bothering you on a solved post, I'm developing a shmup too, bullet hell genre to be precise, and i got curious while looking at you wave events, do you mind spending a few words to tell me how you managed the wave system ? :)


Sure, I would love to but do keep in mind, I am a total amateur at programing and there might be better ways of doing things, first off I have a bunch of global variables

game time = which keeps a track on how many seconds have passed into game
body count= how many enemies have died this gets added to not only when a player kills one, but also when one gets off screen
wave = the enemies come in waves once one wave is destroyed the next will appear.


so say it is wave 8 and i have killed 20 enemies the programing will say
System wave < 9
System bodycount = 20 System Add 1 to wave

that way I can switch to what ever wave I want when i need to test the game
B
14
S
4
Posts: 125
Reputation: 1,385

Post » Mon Jan 16, 2017 6:03 pm

I see, thanks a lot for sharing these infos, gave me a general idea on how to possibly manage waves!
Image
B
21
S
7
G
3
Posts: 32
Reputation: 2,977


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, valefor and 6 guests