0 Favourites

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

  • 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. <img src="smileys/smiley26.gif" border="0" align="middle" />

    <img src="http://i.imgur.com/OovpzwD.png" border="0" />

    The code enters the function over and over but the nearest target seems to only be set once. Anyways, any help would be awesome.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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! ^^

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)