AI and LOS problems.

This forum is currently in read-only mode.
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi.

    Currently i have problems setting up a very simple ai. I have a enemy sprite with RTS and LOS behaviour. The enemy should chase the player sprite and when the player is in the line of sight(in the current cap it is 300) the enemy sprite should stop, play the shooting animation and spawn a bullet in direction of the player.

    But something is wrong. The enemy chases the player but don't start shooting at the player. The enemy sprite start shooting when it arrives at the player, but this is much to late.

    I think the problems must be with the private variables. So here is my cap file:

    http://www.mediafire.com/file/90c6pb596 ... owTest.cap

    The events for the enemy are in the enemy group in the event sheet. Maybe someone can be so nice to tell me what i'am doing wrong.

    ((edit: link repaired))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Link is broken.

    Also, I heard the LOS behavior is glitchy. But maybe you should try the distance(x1,y1,x2,y2) value. for example:

    +System - For Each Enemy 
      +System - Value: distance(player.x,player.y,enemy.x,enemy.y) Lower or Equal 300
         -> Set speed Enemy to [WHATEVER]
         -> Enemy - Create object Bullet
         -> Bullet - Set angle towards object Player[/code:3usv6dop]
    
    At least, that's how I would do it.
  • Thanks Phobos! This solution works without problems. I think i will use it instead of LOS.

    Anyway, if LOS would work right it would be a very handy behaviour.

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