Non-Selectable instances with PICTURE

Get help using Construct 2

Post » Sat Jun 08, 2013 12:51 am

http://i43.tinypic.com/dr2nlw.png



So as you can see its a sim city like building game where you are building buildings on differences instnaces of the same object. the different builing types are different animations of the same object.

I want to know how to make the instances that are covered by the top and bottom action bars, not selectable

FOR EXAMPLE right now if i clicked the blue buildng at the bottom it would select the instance behind that layer and move the green selector there instead of leave it where it is. this is NOT what i want

B
4
Posts: 20
Reputation: 240

Post » Sat Jun 08, 2013 1:09 am

In the past I have checked if the mouse is below an allowed area, or in a range, that way it can only choose those on the map. Or I have also given the sprites boolean instance variables like "Selectable" and if that one is false you can't select it.
You can set individual instance variables to different values in the editor.

edit:

In other words, when a sprite is clicked, check to make sure is above the menu.
or if the instance variable "IsMenu" is set, allow the click on the menu.Paradox2013-06-08 01:31:33
B
230
S
62
G
33
Posts: 902
Reputation: 40,319

Post » Sat Jun 08, 2013 6:03 am

I've usually made separate icons object with the same frames, makes reading events a bit easier.
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Sat Jun 08, 2013 8:23 am

With the new Image Deduplication feature on the latest beta, there's no reason to use the same object as you can make a new one and it won't add anything more as you're using the same image the other objects use. (Current stable version doesn't have this so each sprite/frame that has the same sprite just has their own copy of the image they use)
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Mon Jun 10, 2013 5:45 am

That wouldn't solve the problem though, as the one he wants to prevent clicks on, is under the "different" sprite. Still getting a click for being in the same place.
B
230
S
62
G
33
Posts: 902
Reputation: 40,319

Post » Mon Jun 10, 2013 5:54 am

The simplest method is to use a instance variable doing a variable comparison to filter out the instances you don't want to introduce into the selected object list.
Like:
+>sprite.varaiable("canBeTouched") = 0
++>on touched sprite... do stuff.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests