[SOLVED] stop clicking all instances under the mouse click?

0 favourites
  • 7 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • G'day all,

    I did some searching but at a guess my terminolgy / wording was off because I'm sure i've seen this referenced somewhere before:

    Problem: All instances under the mouse click will run the related code.

    What I am trying doing:

    When mouse clicked on the tiled background object I set pathfinding into motion for some objects. (to the mouse X, Y) ...working just fine.

    When I click on other objects they become moveable (drag and drop behaviour). ...working just fine.

    What is happening:

    When you click the object to move it, the call is also made for the pathfinding. The click on that part of the screen seems to call both the objects under the mouse at that time, I just want the top object to run it's code.

    Thanks in advance. (also please advise if I provided too much info)

  • This is still an active question. It's one way of doing it.

  • G'day Codah, (and others).

    This did not seem to help.

    I added another layer.

    I added the step of 'is on layer' as was suggested in your link (viewtopic.php?f=146&t=121953)

    It didn't seem to matter. Perhaps I implemented it wrong

    This is the object i am wanting to only click (on layer 2)

    [attachment=1:1422sa6e][/attachment:1422sa6e]

    This is the tile object I am wanting to click (if no object is above it) for movement purposes (on layer 0)

    [attachment=0:1422sa6e][/attachment:1422sa6e]

  • Check that the cursor is not over the sprBldBoxDBL object on the bckTileGrass click event...

    On Left button Clicked on bckTileGrass

    X Cursor is over sprBldBoxDBL

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Excelent!!

    Prior to seeing your response I created a global variable Yes/No for if I can or can't click on bckTileGrass. When I click on sprBldBoxDBL it sets the variable to NO

    When the code comes to the bckTileGrass it checks that the variable is YES.

    If YES then action performed ELSE set variable to YES

    At the moment I am going to stick with my solution as there will be many more objects that can be clicked and each one will set a variable to NO as opposed to making a chain of X Cursor is over Object_name

    But your solution was GREAT now anyone else looking can do either!!

  • You could also add all objects to a family and check for the cursor not being over the family instead of a specific object.

  • That would have suited good

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