Making a monster follow player

Get help using Construct 2

Post » Wed Apr 01, 2015 10:15 pm

I have a few questions so I'll label them;

1) How do I make monsters detect the player? Is this always done with the LOS behavior? Is there a "object is in range" event?

2) What's the difference between making a bullet or 8direction monsters? Which one should I use? I want the monsters to wander around until noticing the player.

3) How can I get a monster to follow player without changing the visual angle of the sprite. I want the sprite to stay same way constantly but follow the player.
B
4
Posts: 10
Reputation: 220

Post » Wed Apr 01, 2015 11:30 pm

1. Here are a couple ways.. LOS is one. Running an event on your monsters that compares monsters X,Y position to players and if less than player.x+range, player.y+range then toggle an in range variable... or use an invisible "detection radius sprite pinned to player to trigger monsters (like I did here with "sound radius" https://drive.google.com/open?id=0Bx-ufu2WID53SGg5cDgzOF9Qa00) (click the download arrow in the upper right of screen)

2. Either way is fine but you have more control using bullet behavior. You will have to make events either way that determine when the monsters goes a certain way regardless. Making a monster wander is simply AI, make an action loop where monster randomly changes directions or actions every so often.

3. You would be best using bullet behavior for movement then since it doesn't change sprite angle unless you tell it, the sprite angle should remain unchanged unless told to angle to direction of movement (which most behaviors do internally, so use bullet and make own movement events).
Last edited by chrisinfinger on Mon Sep 05, 2016 10:22 pm, edited 1 time in total.
B
40
S
8
G
3
Posts: 546
Reputation: 5,085

Post » Thu Apr 02, 2015 8:11 am

Thanks for the reply!

About the 3rd question; how do I set the bullet's movement direction without changing the visual angle of the sprite?
B
4
Posts: 10
Reputation: 220

Post » Thu Apr 02, 2015 8:50 am

I was daft on #3. My recommendation in your case would be to have a hidden control sprite that you pin the primary monster to. Then you can be free to use bullet angle changes without extra events. Just make sure to pin monster on position only and not position&angle.
B
40
S
8
G
3
Posts: 546
Reputation: 5,085

Post » Thu Apr 02, 2015 11:19 am

So there's no way of moving the sprite (with bullet behavior) without changing the angle? :(

With 8direction I am able to disable the angle changes. Could I move the monster sprite towards the player with 8direction while maintaining the 0 degree angle?
B
4
Posts: 10
Reputation: 220


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest