How do I make an upper Sprite cover a lower Sprites?

Get help using Construct 2

Post » Mon May 09, 2016 8:05 pm

I am trying to make a top Z order Sprite cover lower Sprites so they are no longer selectable with the mouse or touch.

Basically, I have blocks that are normally selectable that I want to make them impossible to select when a specific Sprite is above them visually. Whether the Sprite is a transparent mask or a solid object.

It seems like using the Z order is the most obvious solution, but I am open to suggestions.
B
40
S
18
G
5
Posts: 98
Reputation: 5,651

Post » Mon May 09, 2016 8:31 pm

Or with an instance variable?

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 09, 2016 9:36 pm

I'm not sure I understand what you mean. Is that a question or a suggestion?
B
40
S
18
G
5
Posts: 98
Reputation: 5,651

Post » Mon May 09, 2016 11:45 pm

On click, check if the object is overlapped, if so ignore the click.
B
42
S
18
G
8
Posts: 496
Reputation: 8,412

Post » Tue May 10, 2016 4:41 pm

Great! I am very new to this so I will try experimenting with Booleans.
B
40
S
18
G
5
Posts: 98
Reputation: 5,651

Post » Tue May 10, 2016 9:44 pm

I am having trouble understanding the Booleans and getting them to function as I would like.

Also, where do I place them? As a condition or an action?
B
40
S
18
G
5
Posts: 98
Reputation: 5,651

Post » Tue May 10, 2016 9:48 pm

You would set the instance variable as an action like is moveable to false
Then you check condition boolean is NOT set (you invert with a right mouse click)

Or you make instance variables with numbers or letters - her you check condition objSprite variable = "moveable"

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 16, 2016 10:00 pm

I am having the hardest time making something false change to true.

I have the instance variable set to false and I have it named. Where do access the action? It is not available in under 'system'. When 'sprite1' is overlapping 'sprite2', I want the Boolean to change values, but I cannot find the action.
B
40
S
18
G
5
Posts: 98
Reputation: 5,651

Post » Mon May 16, 2016 10:04 pm

You find it in your object_Sprite
it's like that with all instance variables

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 16, 2016 10:04 pm

Event: Your Upper Object -> Is overlapping another object -> Your Object below
Action: Your Object below -> Toggle Boolean (true)
-> Else: Toggle Boolean (false)

Then take that Boolen as another condition to your touch event, so it only takes place when that boolean is true:
Condition: Your Object below -> Is boolean instance variable set

This condition will check if its true, if you want to check for false you have to invert that condition.
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION, tarek2 and 18 guests