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

0 favourites
  • 8 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • 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

    so i am trying to make a sprite called the object spawner and it spawn enemies on the fly

    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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.)

  • 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.

    Move the 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

  • 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

  • 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 ?

  • 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

  • I see, thanks a lot for sharing these infos, gave me a general idea on how to possibly manage waves!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)