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

Just started using Construct 2? Post your questions here

Post » Sun Jan 04, 2015 11:32 am

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)
Last edited by humpty on Tue Jan 06, 2015 10:13 am, edited 1 time in total.
B
7
S
1
Posts: 26
Reputation: 549

Post » Sun Jan 04, 2015 11:35 am

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

viewtopic.php?f=146&t=121953
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Jan 04, 2015 11:59 am

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)
scirra1.png


This is the tile object I am wanting to click (if no object is above it) for movement purposes (on layer 0)
scirra2.png
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 26
Reputation: 549

Post » Mon Jan 05, 2015 4:38 pm

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
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
15
S
3
G
1
Posts: 329
Reputation: 2,012

Post » Tue Jan 06, 2015 10:13 am

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!!
B
7
S
1
Posts: 26
Reputation: 549

Post » Tue Jan 06, 2015 4:04 pm

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

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
15
S
3
G
1
Posts: 329
Reputation: 2,012

Post » Wed Jan 07, 2015 11:53 am

That would have suited good :) ty for comming back and adding that in. Now the next time someone is looking they'll find a few options :) :) :)
B
7
S
1
Posts: 26
Reputation: 549


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests