Event with layers

Discussion and feedback on Construct 2

Post » Tue Nov 22, 2011 7:24 pm

Hello

I was wondering if it would be posible to effect objects, depending on wich layer they are.
Theres already an action that makes it posible to move the object to different layers so I think this combination would be nice.
I have noticed that layers sofar got more function just for visual organization and parallax effect but it would be nice to have an condition like, If player is on layer1, make this solid object on layer2 inactive, or prevent overlap or conllisions.

I could imagine using this for example for enemy ambushes where the enemy is in the bg and can hit the player only when they are in the same layer.

Or a puzzle like adventure game where the player can get to the platform in the bg for extra treasure and evenrything in the foreground wont effect the player, especialy the solid objects.


B
43
S
9
G
5
Posts: 231
Reputation: 7,291

Post » Tue Nov 22, 2011 7:27 pm

I'll see if I can add an 'is on layer' condition in a future build.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue Nov 22, 2011 9:34 pm

Miu3, this can behavior can also be performed with events, as such:

OnLayer Example

Assuming this is the behavior you're looking for.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Sat Nov 26, 2011 4:26 am

It can be done with variables, by assigning a variable to a player (let's call the player Hero, and the variable myLayer).

System -> every tick: Hero.myLayer = Hero.LayerNumber

Keyboard -> onKeyPress(1): Send Hero to layer 1
...
Keyboard -> onKeyPress(7): Send Hero to layer 7

IF Hero.myLayer == 2, do.this


So it's possible, but just a little roundabout.
B
14
S
1
G
2
Posts: 85
Reputation: 2,810

Post » Sun Nov 27, 2011 3:42 pm

Thankyou, the ideas are very helpful :)
B
43
S
9
G
5
Posts: 231
Reputation: 7,291


Return to Construct 2 General

Who is online

Users browsing this forum: blackhornet, NetOne and 1 guest