Enemy Movement Weirdness

0 favourites
  • 4 posts
From the Asset Store
This template provide Turn Based strategy engine + Rewarded admob + In app purchase + Level unlock + In game store
  • Hi, I've got a pretty simple question pertaining to some odd behavior by the enemies I've created.

    It has two LOS behaviors: A big one that sets it active (Enemy01los01), and a smaller one that tells it to attack (Enemy01los02. When the player leaves the smaller one, it's supposed to set the enemy back to the walking animation, and it only sort of does. The enemy gets stuck at the beginning of the walk animation for a few seconds before it fixes itself, and I can't figure out why.

    Here is the entirety of the enemy's code. Anything jump out that could be the culprit?

  • Easy.

    This all things hapend every tick. So when your player is close to enemy it wait random time then attack. But it hapend every time so for example 60 times per second. So script will do this 60 times. Script wait random time 60 times per second and then attack 60 time per second.

    You must add boolean isattacking. When is attacking is true dont attack. When you attack before wait set isattacking to true. And after animation attack end set isattacking to false. At start isattacking is false.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, that fixed the problem! I figured it'd be a pretty simple solution. I sometimes forget that actions execute every tick unless you manually tell them not to.

  • edit: moved to its own thread as it is a different question entirely

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