How to create a weakened state for an enemy?

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Hi everyone! I'm new to Construct 3 and I'm exploring its features before taking on bigger challenges.

    I was trying to make a "weakened state" system for an enemy in which we can either jump on its head or throw a block at it to make it weakened, and then we can do any of those actions again to kill it. This part is working as intended, but the issue arises when I let the Weakened timer run out (4 seconds) and try to weaken it again. For a little while, it simply doesn't work or it works for less than 4 seconds.

    Weakening by block:

    What happens when the enemy is Weakened and when it's not:

    Weakening by jump:

    I would love if someone could shed some light onto this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try add action "wait for previous action" in System-Time with a clock icon.

  • Move these two actions into event 23:

    Wait 4 seconds
    LargeE Set Weakened to false
    
  • Move these two actions into event 23:

    > Wait 4 seconds
    LargeE Set Weakened to false
    

    This solved, thank you so much! I have also tried adding the Timer behavior to the LargeEnemy and replacing the System Timer action to the behavior Timer, and then set an event to revert the Weakened state On Timer, but it didn't work, the enemy got stuck in the Weakened state. Do you have any idea of what it could be?

  • Yeah, the Timer behavior would be the best option. The code is very simple - in event 23 start the timer, and add another (top-level) event:

    Enemy On timer set weakened to false

    In the future avoid using "Wait" action in events which can run on every tick - this will always cause troubles.

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