How do I add some chaos to my enemy movement?

From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • I've got a game where something pops-up in a random location, and a group of enemies head towards it.

    However, using the MoveTo behaviour they just straight-line it when it appears.

    I wondered if I could add a little variety to the movement? For instance make them move in a random direction first for 1 second, then turn to head to the object?

    A bit like they're looking in random directions then they see it and head towards it?

    Any other suggestions?

    I can set the direction to a random angle first... but can't get them to move in that direction for a second or two before heading straight at the object.

    It's a top-down game FYI.

    Thanks for any help.

  • Hmmm, interesting idea/question. Maybe after they spawn set their angle to a random selection using random(). Then do a System>Wait for how long they should wait, and then have them find a path to the object they move to. Then have them move to that object?

    You could even set a random angle, then move in that direction for a set wait time, then find the path, and move to the other object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply.

    I've set a random angle to begin with, but what is the command to make them move off in that angle in the first place?

    I'm used to setting a target. I'm not sure how to point something in a direction then sending them off before I give them a target to follow?

  • "Move at angle" would make sense to me.

    EDIT: The parameters would depend on the behaviors set. Could be something like:

    Angle: "objectname.8direction.MovingAngle" if it uses the 8 direction behavior

    Distance: Would be up to you, while the system>wait is running.

    Or even just "objectname.Angle" for the "Angle". It all depends on how the object/sprite is setup.

  • I hope this helps. If not, and you are comfortable sharing your project file, I can take a look, and see how it's setup, and make a couple adjustments for the desired effect. We could jump on Discord, if you are on there, talk some more, and get it working the way you're looking for.

  • Apologies for the late response, your solutions ended up working perfectly and added just enough random movement before the targeted movement to get the result I was looking for.

    Now to finish the game...

  • Excellent! Happy to hear, I was able to help. Good luck with the rest of the game :)

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