How do I lock layers from clicking?

Just started using Construct 2? Post your questions here

Post » Wed Jun 04, 2014 1:41 pm

Hey everyone,

I'm very new to Construct 2, and I'm working on making a game where I need objects to appear on and off of the screen. Right now, I have them each on a separate layer set to invisible, and when a certain object is clicked they become visible (and vice-versa). However, I've noticed that being on an invisible layer does not prevent an object from being interacted with, and this would cause issues with my game. Is there any way to lock (and unlock) a layer from being clicked on by the player?

Or, is there a better way to do this? While writing this post, I had the idea of moving the objects off the screen and having them change position to onscreen when a certain object is clicked. This would be rather tedious though, since I have things like a Calculator which consists of 19 different objects that would have to be moved.

Does anyone have any suggestions?
Thanks :)
B
6
Posts: 3
Reputation: 232

Post » Wed Jun 04, 2014 1:52 pm

You can add multiple conditions to an event.
And each object has a "Is visible" condition.

In your event where you handle when the user click on them, add a condition "Object is visible".
This way, when the object is invisible the event won't execute.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487

Post » Wed Jun 04, 2014 1:57 pm

Fantastic, this works perfectly. Thank you for the quick response.
B
6
Posts: 3
Reputation: 232

Post » Wed Jun 04, 2014 1:59 pm

Just adding additional info:
Blackhornet did a great example here

Another method is to place events into groups and deactivate/activate them.
However, using the condition is visible is very neat and tidy.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Wed Jun 04, 2014 3:29 pm

@DUTOIT, I just tried this out, but when I tried to add the action "Set group active" and type in the group's name, the event group didn't appear in the list below.
B
6
Posts: 3
Reputation: 232

Post » Wed Jun 04, 2014 7:02 pm

It doesn't appear in list :) Its like a function you have to type it as you originally named it.
Create Group and give it a name Group One.

Now system > set group "Group One" Activated.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests