How do I Update Pathfinding on mouse move

Get help using Construct 2

Post » Tue Sep 27, 2016 11:06 pm

Hello guys,
I'm trying to make an isometric test using mouse + pathfinding, what is happening:
The movement is working, when I click on some place the player will go there (cool) but if I stay with the left mouse clicked and move around the pathfinding don't update the route, do you know you can I do this?

I would not like to use every tick..
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Wed Sep 28, 2016 5:50 am

klabundee wrote:I would not like to use every tick..


I know how you can do it...using every tick. :D
B
45
S
15
G
73
Posts: 2,021
Reputation: 43,424

Post » Wed Sep 28, 2016 7:21 am

The exact way to achieve what you asked is to store the mouse x/y values in a variable every tick, and compare the current location of the mouse vs the stored value as a condition before updating the variables with the new values.

This won't be much different than every tick though.

A more efficient method would be to have an update event run with the mouse button is down and every x seconds conditions.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Wed Sep 28, 2016 8:00 am

plinkie wrote:
klabundee wrote:I would not like to use every tick..


I know how you can do it...using every tick. :D


Yeah, I know haha, I just think that every tick is too huge..
Maybe if we have a better pathfinding plugin..
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Wed Sep 28, 2016 8:01 am

oosyrag wrote:The exact way to achieve what you asked is to store the mouse x/y values in a variable every tick, and compare the current location of the mouse vs the stored value as a condition before updating the variables with the new values.

This won't be much different than every tick though.

A more efficient method would be to have an update event run with the mouse button is down and every x seconds conditions.


Yes, I'm working on like you said.
Thank you.
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests