Spawn on layer - XXX.LayerName

Get help using Construct 2

Post » Tue Aug 16, 2016 3:54 pm

Hello fellas.

So I am going through some capx from assets and engines made by users to learn how they do some stuff and I encountered this code quite a lot.

Basically when the dev wants to spawn something on the player does this code:

player is the player box/hitbox.

Spawn whateveryouwanttospawn on layer player.LayerName(imagepoint 1).

Excuse me if I sound silly but normally if you use this event you will have to select the layer you want to spawn it but I'm guessing this is some code to use the event in your favour and actually spawn it on the player itself? I'm kinda confused. He does this quite a lot

Thanks for the help in advance
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Tue Aug 16, 2016 5:28 pm

Yes it will spawn the object on the layer that the player is on at the time the event is triggered. player.LayerName is the current layer that the player is on.
B
47
S
17
G
81
Posts: 2,227
Reputation: 48,101

Post » Tue Aug 16, 2016 5:47 pm

plinkie wrote:Yes it will spawn the object on the layer that the player is on at the time the event is triggered. player.LayerName is the current layer that the player is on.


Thanks! So I guess this is a smart way to use this call right? Would you suggest such a thing?
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Tue Aug 16, 2016 5:50 pm

it is useful. it will allow you to spawn something on the same layer as the player without creating additional logic to find out what layer the player is currently on, if you know what I mean. The info is already stored in 'player', or whatever the object is.
B
47
S
17
G
81
Posts: 2,227
Reputation: 48,101


Return to How do I....?

Who is online

Users browsing this forum: MrSkailo and 24 guests