Problem recreating an enemy with original instance variables

0 favourites
  • 2 posts
From the Asset Store
Create a boss fight with this easy to follow game pack. Recreate the classic attacks of Mutoid Man from Super Smash TV
  • Hi there,

    I have a mechanic in my game where enemies respawn after a set amount of time. Rather than storing each enemy spawn-point in an array including all their various instance variables, I have a Spawner object that recreates all the enemies of the correct family after a certain time has passed (the countdown is set when the enemy is destroyed).

    In my game as well, enemies only die when a certain variable matches a certain other variable. Specifically, an enemy has to match the colour of the backdrop (the backdrop is one variable, the enemy colour is another, a condition checks if they match, and they destroys the enemy if they match).

    No enemy starts off in the same colour as the backdrop - the character has to change their colour with a magic brush.

    The problem is, when the spawner recreates the enemies, the enemies respawn and then die immediately. I assume this is because their instance variable isn't set to match their starting conditions.

    If I'm right, this doesn't seem to be as I understood recreate to work - shouldn't it recreate the enemy in it's original condition? Shouldn't this include instance variable settings? If not, what am I missing here? What is causing this to fail?

    I can't find any clear guidance on recreate anywhere on the site. The manual doesn't mention it, and the online help doesn't mention instance variables. I also found no discussion on the forums, but I could have missed something.

    Thanks for any help rendered!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah! I figured it out. It was picking all enemies at once (since they were all colliding with the backdrop at the same time and mixing them all up. I added a "pick random" and it solved the problem.

    Thanks!

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