How do I Pathfinding Objects Stunned or Shooting w/ Lineof

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Quick rundown. Enemy guys are coming from the right, good guys that the player controls on the left.

    Enemy guys are picking a random target point on the left side of the map and finding a path to that after the on create event. Good guys for sake of arguement will throw rocks at the enemy as they approach, and when hit by the rock they are stunned which should cause them to pause for 1-2 seconds before proceeding if and only if they do not have a line of sight to the good guy.

    My problem is I can only get one of those solutions working at a time. So its either I can get the enemy to stop for a brief moment after being hit by a rock, and then they proceed until they are hit again, or I can get them to stop when they have line of sight and throw their own rocks. I can never get it to where the enemy is stunned if they dont have line of sight and also the enemy will stop to throw rocks if there is line of sight to the player and after the enemy or line of sight is no longer there to start moving again. It almost seems like invert has line of sight (doesn't have line of sight) to object doesn't work after they had line of sight.

    I can get the enemy to throw rocks when they have line of sight, but then the event that causes the stun overides them being stopped and sends them moving again, or I can get them to stop when line of sight is there, but cannot get them to move again after the line of sight is no longer there.

    Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bump for more visibility. Anyone have any ideas?

  • Hm…

    If you add a timer and two private Booleans (I’ll use “stunned” and “LeroyJenkins”) to the enemy, you could say

    1. (Inverted) ENEMY is stunned

    ENEMY has LOS to PLAYER

    Trigger once

    -> ENEMY set LeroyJenkins true

    -> ENEMY stop

    2. PLAYERROCK on collision with ENEMY

    -> ENEMY stop timer “OhNose”

    ->ENEMY start timer “OhNose” for 1 second

    -> ENEMY stop

    -> ENEMY set stunned true

    -> ENEMY set LeroyJenkins false

    3. ENEMY on timer “OhNose”

    -> ENEMY set stunned false

    4. ENEMY is LeroyJenkins

    -> (the logic you use for shooting the player)

    5. Else

    -> ENEMY move along path

    Where "ENEMY stop" is the pathfinding "stop" action.

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