Obstacle detection/Path Lenght

0 favourites
  • 5 posts
From the Asset Store
Obstacle Impacts and Cartoon voices, will makes your game more funny!
  • I'm currently making a platform game with a main chahracter and a fairy that follows him, and you may switch between them. The game has 3 types of character control: Control only character (platform), control only fairy(8-direction) and control character while fairy follows him, like Navi and Link.

    The point is: as i want, to switch to follow mode, the distance between player and fairy must be lower than a distance i defined, but if they are separated by walls, the fairy just go through it. This is because in the follow mode the fairy is just a sprite, while in control mode is a 8-direction.

    I wanted to make the game switch to follow mode only if the PATH LENGHT were lower than a minimun, rather than the direct distance.

    Sorry for any grammar error, i'm not american.

  • You could possibly use the pathfinding for getting the length of a path, then compare it with the distance given to you by the distance expression.

  • But how do I get the lenght of a path?

  • Isn't the fairy just finding path to the player so the distance between the fairy and the player is the same as the path length, or am I missing something?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Actually, when you change from control mode to follow mode, it disables the 8-direction behavior and the fairy becomes a normal sprite without behaviors, floating behind the character.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)