[SOLVED]Problem with "select nearest" function...

Get help using Construct 2

Post » Sat Jul 20, 2013 11:19 am

I have an issue which i can seem to solve. The function that i am using is to calculate which of all module-objects are closest to the current target you are dragging.

To test it i have tried different debug texts and i even set the nearest target opacity to 50. The crazy thing is that the function seems to work... but only one time and this is what i can't figure out. While I'm dragging, why doesn't the nearest target update? It only does it one time when i start the drag event.

It's probably something simple but I've been staring at this code since yesterday and i can't find what's wrong.



The code enters the function over and over but the nearest target seems to only be set once. Anyways, any help would be awesome.hdnine2013-07-20 13:48:38
B
7
S
2
Posts: 38
Reputation: 555

Post » Sat Jul 20, 2013 1:50 pm

I finally found out what the problem was. My function for calculating the nearest object was just fine. The issue was in the fact that, when setting the current target, i only did this at one time and never kept updating the "currentTarget" X and Y positions.

Because of this, nearest target was only calculated on time. Thanks for anyone reading this post! ^^
B
7
S
2
Posts: 38
Reputation: 555


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, FabianB, lukezero, RoaringPixels and 12 guests