How do I get monsters to move toward player instead of away?

Get help using Construct 2

Post » Tue Mar 17, 2015 2:22 am

I think the monsters in my first Platformer are cowards.
When the player moves toward them they flee backwards.
I think it has something to do with getting the monster sprite objects to be aware of the player and move toward it, but a bit a loss on how-to. Any suggestions?
B
8
S
2
Posts: 21
Reputation: 509

Post » Tue Mar 17, 2015 2:34 am

what's the coding you use?
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Tue Mar 17, 2015 2:46 am

I just thought I could set a behavior for the sprites and it could get one sprite to follow another. IS the trick that I should put some logic linked to System.Every Tick to have one sprite follow the other?
B
8
S
2
Posts: 21
Reputation: 509

Post » Tue Mar 17, 2015 3:07 am

You can use LOS Line of sight to detect the player within certain radius. Then tell the enemy to chase the player.

If the player is out of reach, you cell tell the enemy to standby.

If currently the enemies are running away, probably you told them to do so in your coding.
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Tue Mar 17, 2015 10:36 am

That was exactly what I was looking for. "Has Line of Sigh to player t --> Move Forward -1 "

Need to add some other conditions to get it flip, toward but am on my way.

Thanks you for the direction.
B
8
S
2
Posts: 21
Reputation: 509

Post » Tue Mar 17, 2015 10:56 am

You could try and do the beginners tutorial :)

that will help a lot.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Wed Mar 18, 2015 12:17 am

Thanks also found this video on how to make your monsters smarter to be helpful. https://www.youtube.com/watch?v=A0YwMu9 ... rLS-N0nKF-
B
8
S
2
Posts: 21
Reputation: 509

Post » Mon Mar 23, 2015 10:40 am

Actually the Newbie mistake was that I had added the Platform behavior to all the monsters. By default it is set to 'Default controls = True'. So my actions were being echo'd by the monsters, which is why they were running away.
B
8
S
2
Posts: 21
Reputation: 509


Return to How do I....?

Who is online

Users browsing this forum: Allardje, Rudi55, sublimate, Yahoo [Bot] and 1 guest