Count enemies using a specific instance variable?

0 favourites
  • 5 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • My objective is to have a door locked until all enemies and their spawn points are destroyed. I am using a "Pick by comparison" then "PickedCount" to count all enemies that have health greater than 0.

    This is being done for 2 different sprites; comparing to an enemies health and their spawn points health. The spawn point plays a destroyed animation that stays on screen, so it isn't destroyed when health is goes to 0, but the enemies are destroyed. The count seems to work for the destroyed enemies, but not for the spawn points. I do plan on making a dead enemy animation rather then destroy in the future as well. Any thoughts as to why the counts aren't working would be greatly appreciated. Thank you.

  • I changed a few things around and noticed some typos, but still not sure if this is the best way to accomplish this task. Alternatives are welcome and appreciated. Thank you.

  • That's better. I was formulating a response about how the picked count actions must be in the same event. You won't need the Else though because you are picking a number of instances and if it's 0 then EnemyCount will be 0.

  • Thanks for your feedback. I thought it would go to 0 as well but doesn't appear to go into the action if if the pick by comparison event is not met.

    Is this the most efficient way of locking a door until certain conditions are met or is there another way that you think might be better?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah yeah seems to be correct then, nice! Looks solid to me, there isn't much possbility for bugs. Only problem would be if the condition about less than 0 objects runs before you have the chance to spawn the enemy and spawn point into the level so make sure any spawn actions are done earlier.

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