Having actors sense another actor is next to them/animation

Hello all! My goal in my current project is to get an actor to sense another actor is next to it. To be specific I am using 32x32 boxes which need to know when another box is to the right, up, down, or left of itself. It needs to store the actor type it is next to and also the animation in which that actor is in. I don’t know how to even start with something like this since I am fairly new to stencyl (I know how to do basic functions like actor movement, firing, and similar beginner stuff). Any and all help would be so appreciated as I am currently stuck.

Vaibhav Sangwan

  • Posts: 157
There is an extension called Raycast API.
Use the block "first actor on line" present in that extension.

Bombini

  • *
  • Posts: 963
Another, maybe a simpler approach would be to check the coordinates or distance.

Coordinates (if using a grid):
Check if actor2 x is actor1 x plus 32 (for right next to it for example)

Distance:
Check if actor2 x is < as actor1 x and > as actor1 x

Cheers!

Another, maybe a simpler approach would be to check the coordinates or distance.

Coordinates (if using a grid):
Check if actor2 x is actor1 x plus 32 (for right next to it for example)

Distance:
Check if actor2 x is < as actor1 x and > as actor1

Cheers!

Thanks for the great help! Going to implement this today!

There is an extension called Raycast API.
Use the block "first actor on line" present in that extension.

Thanks for the great help! Although API extensions are quite complicated I’ll give it a shot if bombini’s solution isn’t adequate. Either way thank you lots!