How to continuously check for distance between actors?

Hi! Have been working on this 2D side-view project where the level structure is designed as followed: the main character moves along the way automatically until it reaches an obstacle. There are 2 kinds of obstacles and the character automatically stops approaches any of these objects. Different obstacles represent different puzzles for the player. The problem I fave is that I can't manage to detect whether the character reaches the obstacles or not. The methods I used are as followed: 1. Calculating distances between obstacle types and the character separately by the help of magnitude function and assigning these values to global attributes called respectively. Then creating new boolean attributes for checking if the desired distance is reached or not. And creating rules for the character so when it reaches the desired distance between itself and an obstacle it stops, else it continues moving. 2. Using table for obstacle states. Creating columns representing the obstacle IDs, obstacle positions and boolean valued column which represents if the obstacle is reached or not. Comparing the character's position with the values in the table and using loop over table behaviour. Unfortunately, these methods either didn't work or checked only the first obstacle ( no matter what type ) on the way and didn't recognize others. Would appreciate if someone would share their thoughts on how to fix this. Thanks in advance!

Answers

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881

    You could try detecting if the main character collides with an obstacle character.

Sign In or Register to comment.