How do I make an enemy to give priority over other events

0 favourites
  • 4 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hello

    I'm trying to make the AI for one of my enemies. Basically is sleeping and whenever the player is on sight starts moving either left or right. Once the player is out of sight goes back to sleep.

    Now, if the enemy runs into a wall turns around in the opposite direction so if he's facing away from me and losses sight, whenever I get close, he keeps walking in the opposite direction that was called by the wall event to turn around so it feels like I'm chasing him.

    I've been trying for hours different events to make him come towars the player when he wakes up rather that keep going in the direction called by the wall event.

    Here's the code:

  • Because event 35 - 38 are subs under 'is sight', 'it' can only change direction when 'it' sees Player.

    On the moment 'it' can't see Player, 'it' keeps moving in the direction that it was allready moving. 'it' just cant change direction.

    Bring those events outside the 'is sight'.

    Also, the animation changes to 'sleep' when 'it" is not seeing the player. But there is no action that makes 'it' actual sleep', if sleep = also stop moving.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Because event 35 - 38 are subs under 'is sight', 'it' can only change direction when 'it' sees Player.

    On the moment 'it' can't see Player, 'it' keeps moving in the direction that it was allready moving. 'it' just cant change direction.

    Bring those events outside the 'is sight'.

    Also, the animation changes to 'sleep' when 'it" is not seeing the player. But there is no action that makes 'it' actual sleep', if sleep = also stop moving.

    Thanks will test tomorrow.

    Btw it does stop moving and goes to sleep

  • So I tried whay you said and made no difference. The enemy behaves the same way.

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