how do i switch solid states and control pathfind

Get help using Construct 2

Post » Tue Aug 05, 2014 5:10 am

ok, when a solid object is there,
a sprite will automatically avoid the solid object as obstacle.

but i dun get it why when i make the solid object non-solid,
the sprite stills automatically avoid the solid object as obstacle.

making games is hard, sigh...
You do not have the required permissions to view the files attached to this post.
B
28
S
13
G
15
Posts: 87
Reputation: 10,469

Post » Tue Aug 05, 2014 5:55 am

You have to regenerate the obstacle map...

https://www.scirra.com/manual/154/pathfinding
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 05, 2014 7:23 am

thanks a lot!
i have finally been able to switch solid states of objects while
the sprites are able to switch pathfinding through objects accordingly.

i have make the working example, but there seems to be a bug,
the first time i click okay button to change solid states of objects,
the sprites doesn't reacts to it.

subsequent switching of solid states of objects does
successfully cause the sprites to react.
You do not have the required permissions to view the files attached to this post.
B
28
S
13
G
15
Posts: 87
Reputation: 10,469

Post » Wed Aug 06, 2014 2:24 am

You're regenerating the obstacle map before you change the solid state. So it takes it till the second time to register. However, it seems like doing this too fast makes both button click events happen at once. So what I did was added another short wait and ordered those actions like this:

wait 0.1
set solid enabled/disabled
regenerate obstacle map
(guess you need another wait here to let regeneration finish)
then find path

Let me know if that works for ya.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Aug 07, 2014 1:11 am

Sorry to bring up this somewhat old post ....

To check if my gfx card causes severe flickering, I've opened the above capx file and experienced that same as I see on my system.

So now it looks as if my gfx card driver (which is hard to update because I bought a cheap ACER computer to just compile W8 apps) prevents me from working.

If someone can confirm this, I'd be grateful.

Here is what happens when I load the above pathfinder.capx

It loads fine in C2 but as soon as I test the app (preview) the flickering begins.

I am sure it is my system :(
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Thu Aug 07, 2014 1:34 am

@spacedoubt
you are awesome! :o
it works, i have placed the order of events wrongly.

wait 0.1
set solid enabled/disabled
regenerate obstacle map
*( i never place any wait here. )
then find path
You do not have the required permissions to view the files attached to this post.
B
28
S
13
G
15
Posts: 87
Reputation: 10,469


Return to How do I....?

Who is online

Users browsing this forum: Bilderberg CEO, eochranek, fearfulelephants, Solomon and 18 guests