Pathfinding Building Game (HELP)

Get help using Construct 2

Post » Sat Feb 02, 2013 4:52 pm

Hey guys!
I've been working a little bit on a pathfinder building game.

Capx

When you press the black box down at the bottom you can place a "Wall" piece anywhere on the layout. Left click the black box, right click anywhere to place the box. These boxes are supposed to be solid.

Press "P" to switch to play mode, when you are in play mode the player will be using Pathfinder to move around. The pathfinding works perfectly except the fact that the character totally ignores the walls he just moves right through them.

Press "B" to get into building mode. In building mode you can also move the player around.
B
11
S
2
G
4
Posts: 78
Reputation: 3,292

Post » Sat Feb 02, 2013 5:40 pm

@superwifibattler - there's something odd happening with the code, i'm not sure what it is. perhaps something with toggling the groups to active or deactive?

simple pathfinding works with a solid behaviour for the wall piece and adding in the action "regenerate obstacle map" when the mouse is clicked to create a new path.
simple pathfinding
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Sat Feb 02, 2013 6:07 pm

Thanks for the quick reply!
I know how to get the path thing going. The point with the game is to be able to build your own levels.
B
11
S
2
G
4
Posts: 78
Reputation: 3,292

Post » Sat Feb 02, 2013 7:02 pm

that's what i meant by my example, your pathfinding *should* be working but there's something odd going on with the level building plus the pathfinding.
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Sat Feb 02, 2013 7:22 pm

Add 'Regenerate Obstacle Map' to the top of Event 12. The first time you click, the player will go through obstacles but after that he wont.
EncryptedCow2013-02-02 19:25:30
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Sat Feb 02, 2013 7:25 pm

You'll need to add 'regenerate obstacle map' event at the end of the build mode / start of the play mode. Path-finding needs to 'regenerate' it's map as it doesn't dynamically update when you add solid objects into play :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sat Feb 02, 2013 8:58 pm

Yaaay! I added
On P pressed -> Regenerate Obstacle Map
On B pressed -> Regenerate Obstacle Map

It worked perfectly! :) Thanks a bunch.
B
11
S
2
G
4
Posts: 78
Reputation: 3,292


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, gregorysforster, onzephyr and 2 guests