How to make enemies disappear after being shot once. then reappear after time passes.

I have all my enemies spawning from different locations on the map, on a timer set at 2.5 seconds. how do i make it so when I shoot one of the enemies they disappear for one of the spawning periods then they reappear in the next upcoming spawning period. (Ex. Enemy appears, i shoot enemy, 2.5 seconds passes no enemy appears, another 2.5 seconds pass and the enemy reappears.)

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2014

    Are you wanting the same enemy that is shot to then disappear and spawn again? Or just any enemy to spawn again later? And do you care if one enemy is waiting 2.5 seconds but the same enemy spawns within that 2.5 second delay? Because if you have a timer set to every 2.5 seconds and you shoot an enemy 2 seconds after it spawns, it will respawn an enemy 0.5 seconds later based on the timer.

    I guess I really need a more detailed description of what you're trying to accomplish (how many different spawners you are using, how many different enemies you have, etc.).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • gamer456ismgamer456ism Member Posts: 10

    If you want it to spawn in the same place you could make a variable for when they die and a variable for EnemyX and EnemyY. You could then constrain those with "attribute EnemyX = self.position.x" Then when the bullet hits the enemy make a timer like this "For 2.5 seconds Dead = true" then this "after 2.5 seconds Dead = false". make a rule so that when its true destroy them and when its false spawn them in the coordinates that you constrained. This will probably work but if it doesn't post with whats wrong.

Sign In or Register to comment.