Clever movement

Get help using Construct 2

Post » Thu Jul 31, 2014 12:35 pm

i want to enemy move towards player when distance ( distance variable is 120 or less) for 5 seconds. Then enemy walks to random directions.

i have made these already to AI:
-distance variable
-distance variable calculation event
-random enemy movement "when variable noticed is false"

how you do recommend me to do? :?:
~~~~Jabutosama
B
13
S
3
Posts: 68
Reputation: 1,414

Post » Thu Jul 31, 2014 2:16 pm

You can use LineOfSight behavior to detect the "120" distance and activate the enemy movement. Combine this with moveTo behavior provided by rexrainbow and you'll get what you want.


Here the capx of one of my examples:
PS: The red circle is the enemy's line of sight, if you enter on that area the enemy will automatically "follow you".
PS2: maybe you'll need to disable touch movement and enable keyboard movement on "playerInput" EventSheet.


moveTo Behavior: https://dl.dropboxusercontent.com/u/5779181/C2Repo/rex_platform_moveto.html
Capx: https://www.dropbox.com/s/sjwz550n5mjb4mi/hero3.capx
B
8
Posts: 20
Reputation: 302


Return to How do I....?

Who is online

Users browsing this forum: Sparkz and 1 guest