Pathfinding refresh problem

Get help using Construct 2

Post » Tue Dec 22, 2015 12:26 am

Hello everybody!

I've been searching all the evening to fix pathfnding on the game I want to create, I hope someone will be helpful because I'm stuck...

well let me explain the problem simply:

- I want an object to be created every "X" seconds and go from A to B (top to bottom), and add obstacles on mousclic / touch (on a tiled background, so the "floor" is a grid and my object moves from A to B on the center.

The problem is when I refresh with:

"System: Every Tick: MovingObject: Regenerate Pathfinding Obstacle Map"

... The obstacles I've put with "OnTouch" are only visible for newer moving objects, those who are already created don't see the obstacles, and they ignore newer obstacles... I've search all the afternoon/evening and could'nt find a solution (all I found was the " "System: Every Tick: MovingObject: Regenerate Pathfinding Obstacle Map" but it didn't fix the problem.


here's my capx in MEGA: thanks in advance if anyone can help, it may be simple but I can't see what I'm missing
B
2
Posts: 3
Reputation: 179

Post » Tue Dec 22, 2015 8:51 am

*moved to a more appropriate section.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,555
Reputation: 60,454

Post » Tue Dec 22, 2015 1:57 pm

Pathfinding can take more than a tick, so you can not use 'Every tick'. Use a longer time interval.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Tue Dec 22, 2015 1:57 pm

add pick all instances (moving object) before you regenerate map.

also system:each tick is not needed if it's a top level event.

also i'd recommend every 0.2sec instead of each tick. too cpu massive
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455

Post » Tue Dec 22, 2015 4:45 pm

@blackhornet thansk!

@saiyadjin I think this can help but I cant figure out how to use pick all instance AND every 0.2 sec to regenerate them :/, I can either chose one or the other, but can't make an action every 0.2sec ... did I miss something ?
B
2
Posts: 3
Reputation: 179

Post » Tue Dec 22, 2015 5:19 pm

when you put an event:

system - every 0.2 sec
subevent: pick all instances of that object
subevent: regen map for those objects (not sure if you can just use thatobject.regenerate map) or you have to loop through them with foreach (i'd say you can just call regen map since you've picked them all on screen)

top events happen each tick. but when you put each 0.2 sec that particular event is skipped, and happens only each 0.2 sec
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455

Post » Tue Dec 22, 2015 6:04 pm

@sayadjin ... hmmm doesn't do the trick :/

cry cry cry
B
2
Posts: 3
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests