frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Enemies that follow or chase

edited October 2013 in How To
I put together a small example here. There are basically two distinct paths for the logic: one for the "x" (left & right) axis, and one for "y" (up & down).

The logic works like this:
1) A Timer wakes up and triggers each second
2) There are two Extractor nodes, one extracts the "x" position of the player, the other extracts the "x" position of the enemy
3) An Expression nodes takes the difference of the two positions (A - B) and sends the result to a Filter
4) If the difference in position is greater than 0, the Velocity is set moving the enemy to the left, otherwise he moves to the right
5) The "y" axis works the same way, only comparing the "y" instead of "x" positions
«1

Comments

Sign In or Register to comment.

flowlab.io

| make games in your browser
@ 2017 Flowlab.io, All rights reserved.

Contact us

Get In Touch