Enemy chase player

This forum is currently in read-only mode.
  • I have this little guy that I want to move about until he sees the player in sight. Once he detects player he rushes over to bite him, then is delayed a second.

    <img src="http://www.fileden.com/files/2008/3/4/1796632/lil.PNG">

    RIght now I was using the RTS movement and line of sight to accomplish this, which works somewhat.

    CheeseHead is enemy, Spanky is Player:

    CheeseHead: Has LOS to Spanky

    CheeseHead: Animation "Dead" is playing

    CheeseHeadMove to Spanky

    CheeseHead: Does not Have LOS to Spanky

    CheeseHeadMove to (random(100), random(100))

    What I get is a wacky rotating object that follows player but always seems to have him in Line of Sight. I'm not too familiar with these behaviors, anyone have any suggestions?

  • Consider adding a distance argument to the event.

    +Has LOS

    +Distance to Spanky < ###

    =then do stuff

    EDIT:

    As far as rotating, that behavior is avoided by changing the sprite's properties accordingly.

  • I dont get this LOS

    It's not working for me.

    I used a turret to take action based on its tracking angle.

    THis worked well for me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just wanna throw in that the RTS movement's Move To XXX actions run a fairly CPU intensive search algorithm to generate the shortest path around obstacles. You should avoid running it every tick (add an 'every 1 second' or 'trigger once' condition for example) to avoid redundantly wasting CPU time.

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