How do I set a timed enemy attack?

0 favourites
  • 3 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello people, I'm working on a "survival shooting game" kinda The House of the Dead mixed with Splatterhouse vibe <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green"> So far so good until I had to make the enemies attacks <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad"> At start of layout I start an enemies time behavior called [attack] of 5 seconds set that:

    [on Timer "attack"]

    [For Each Enemy]-> they flash and the system sustract 05 from the player health

    All that works fine, the problem is that I wanted one of the enemies to be the "leader" so if you don't defeat that one the others just keep respawning <img src="{SMILIES_PATH}/icon_twisted.gif" alt=":twisted:" title="Twisted Evil"> And there is were I'm having trouble <img src="{SMILIES_PATH}/icon_mad.gif" alt=":x" title="Mad">

    The game itself it's just a little more than a draft at this point, I will change a lot of elements for the final release, but only if I manage to get this working right since is a crucial mechanic for my game <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    This is what I got for now:

    http://satanicalmassacrewip.bitballoon.com/

    And this is the capx:

    http://www.mediafire.com/file/12zhap8wt ... e%2001.zip

    You will see the problem with the timer is disabled (under the "enemies 01" inside Enemies Group) if that timer is not activated the enemies stop attacking, if is activated the player health doesn't stop depleting (when it's supposed to sustract just 5)

    Already thanks to anyone that could point me what I'm doing wrong since I always tend to overcomplicate things in the games I make <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why did you include 94Mb of backups into this zip?!

    You can try something like this:

    Add an instance variable "IsLeader" to your Enemies family. Set it to "True" for one instance which will be the leader.

    When the leader is killed, destroy it and all other enemies.

    If you don't want to destroy other enemies after leader's death, set a global variable LeaderIsDead=1.

    When non-leader enemy is killed , check if LeaderIsDead=1 and destroy enemy.

    If LeaderIsDead=0, instead of destroying the enemy, set it invisible. Start "Respawn" timer.

    On Timer "Respawn" : Set Health=100, Set Visible

    Also, you have a bunch of almost identical events for enemy1, enemy2, enemy3, why don't you use Enemies family in these events?

  • Why did you include 94Mb of backups into this zip?!

    You can try something like this:

    Add an instance variable "IsLeader" to your Enemies family. Set it to "True" for one instance which will be the leader.

    When the leader is killed, destroy it and all other enemies.

    If you don't want to destroy other enemies after leader's death, set a global variable LeaderIsDead=1.

    When non-leader enemy is killed , check if LeaderIsDead=1 and destroy enemy.

    If LeaderIsDead=0, instead of destroying the enemy, set it invisible. Start "Respawn" timer.

    On Timer "Respawn" : Set Health=100, Set Visible

    Also, you have a bunch of almost identical events for enemy1, enemy2, enemy3, why don't you use Enemies family in these events?

    Yeah, it worked! )

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