Obstacle detection/Path Lenght

Get help using Construct 2

Post » Wed Nov 27, 2013 11:07 pm

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.
B
5
Posts: 6
Reputation: 264

Post » Thu Nov 28, 2013 12:40 am

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.
B
10
S
1
Posts: 163
Reputation: 1,436

Post » Thu Nov 28, 2013 1:03 am

But how do I get the lenght of a path?
B
5
Posts: 6
Reputation: 264

Post » Thu Nov 28, 2013 1:08 am

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?
B
45
S
15
G
73
Posts: 2,006
Reputation: 43,394

Post » Thu Nov 28, 2013 1:13 am

@plinkie 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.ninjatulio2013-11-28 01:13:55
B
5
Posts: 6
Reputation: 264


Return to How do I....?

Who is online

Users browsing this forum: ivanski1983, SturmIV and 6 guests