0 Favourites

Pick closest object

This forum is currently in read-only mode.
  • Hello, I have a question about picking the closest object.

    I have the following problem:

    <img src="http://imageshack.us/m/62/555/questionx.jpg">

    The small bar on the left is the user. The big blocks are the same object (copies).

    When the user overlaps an object (as seen in row 2) and presses the space key, the object changes colour.

    When the user overlaps both objects (as seen in row 3) and presses the space key, the closest object (to the user) should change colour. But as you can see in row 3, that doesn't happen in my case.

    I've tried to use the pick closest condition, but that didn't work. Does anyone have an idea on how to solve this?

    Edit: I've also tried the 'pick by comparison and then compared object.x and object.x (but I think that it compares the same object's value against the same object's value..)

    Thank you,

    Maarten

  • 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've tried to use the pick closest condition, but that didn't work. Does anyone have an idea on how to solve this?

    Not sure why that wouldn't work for you. It works perfectly for me:

    http://dl.dropbox.com/u/529356/Construc ... losest.cap

    <img src="http://i55.tinypic.com/24wu81l.png">

  • After reading that it worked for you, I tried it again and found my problem. I called a function to change the colour and tried to pick the right object before I sent the function (with 'remember picked object'). That didn't work.

    It did work when I picked the object after the function was sent. (So pick the object in the function itself).

    Thanks for helping me!

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