How do I Spawn a Sprite when certain criteria is met?

  • Pretty much in a level in my game i have 2 enemies and i want it so when i kill the 2 enemies and they get "destroyed" i want another sprite to spawn or for future levels i want to switch to a different layout.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • have you tried making a sprite make it 10px width and height. Input a variable 'Enemies_count'. and put the number of enemies in it.

    when you destroy enemies -1 from variable 'Enemies_count'. And then run an event like this 'Enemies_count=0' and do what ever action you want to do.

    And if you want something like a specific item to spawn after two and not that third one are killed then just make another variable Item_Timer

    and run the same action of -1 again for on destroyed.

  • Since you want it to carry over layouts, a global variable that you set when object count of the enemies gets to what you want seems like the easiest option.

    Doing it as Gearworkdragon suggests will save you from cluttering the project with too many global variables(all of them being listed whenever you add a system expression and such can be slightly annoying) but you need to make sure that the object is set to global so that it'll carry over.

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