“Movernos a otro Layer”

1

Stats

5,475 visits, 8,680 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 29 Mar, 2013. Last updated 19 Feb, 2019

Hi all!

This tutorial is done so that you can do with the Free version and is suitable for people who has little time in Construct 2, which is achieved with this tutorial is a platform game something different as we move not only by a single "layer" or layer, but we will be able to move to another layer and thus mimic the effect of depth or distance in your character, we will use the effect or layer properties "parallax"

We started ...

1 Creating layers

Create a new document and added two more layers or "Layers", I have called:

-Principal

-Lejos

-Fondo

2 Setting the layers:

In the layer "Principal" we go to the Layer Properties window and leave it as is:

(It is important to change the Transparent property to "Yes")

In the layer of “Lejos”:

(It is important to change the Transparent property to "Yes" and Parallax ownership to 80.80 ... so you can later adjust to your taste)

And finally the layer “Fondo”

(The property Parallax to 0.0 ... The Transparent property is immaterial in this layer.)

3 Setting the Stage.

We create a simple sprite-like this and I have made the name of PlataformaPrincipal where we will go when we start the game.

-Another simple sprite-like this and I've put the name and this will PlataformaLejos when we tele-transported to a layer that is further away.

-Create a sprite to be the character with this size or "size" 30,55:

-We create two sprites-more, where the doors will be in contact with them will move through the layers of our scene to have called PuertaPrincipal and other PuertaLejos, both with the same color (although this does not matter because they will not see and we will place a picture of door above them. The size of them is:

PuertaPrincipal 20,38

PuertaLejos 11,35

I've also included a variable to each of them in the Object Properties window, Instance Variables:

For PuertaPrincipal the variable is Puerta=0

For PuertaLejos the variable is Puerta=1

-Here the door, you can put whatever you like and more:

-And finally a fund:

Once done all this, you will have to have a composition like this:

4 Drawing the scene and layers:

A little advice or help is that you have the buttons to lock the layer and select the view you want to see the layer in the Layers window, lest you lieis and labor cost you moved away by layers or change any sprite by mistake.

The layer Principal I've drawn like this:

(Above you colocáis PuertaPrincipal sprite drawing the Sprite Gate)

Far-layer In the've drawn like this:

(Under the Sprite Puerta I have placed the Sprite PuertPrincipal right where the arrow)

-And finally, placing the Fund on the last layer would have seen this with the three activated:

(It is normal sprite PlataformaPrincipal are more clogged to encircle that are further away, then solved to avoid clogging the character when the layer “Lejos”)

5 Conditions and Actions.

Starting to give movement to our character!

We select our character and object properties window give the behavior or “ Behaviors” Platform, ScrollTo y Flash(The latter is optional!)

We select our platforms and the two we put the behavior Solid

The rest I leave it as is.

You can drag your character to the scene and pressing "Run layout", check that you can move with the arrow keys over all platforms and green dwellings.

We go to the tab "Event sheet1" that is created by default with the "Layout1" and begin to put conditions and corresponding actions:

1 In line one we put the condition that at the start of the layer, and as solid as we share in sprite PlataformaLejos disabled.:

With this line no longer runs into platforms that are located in the layer of "Far". Click "Run layout" and check!

2 In this line we get the following conditions and actions:

A bit of explanation!

The conditions are:if the character collides with PuertaPrincipal and PuertaPricipal local variable is = 0 then the actions are performed.

Actions:

Move the character to the layer “Lejos”

Poner al personaje en esta posición (50,420)

Put the character in this position (50,420)

Put the character with this size (12,25) it seems that this far!

Put PlataformaLejos sprite behavior "Enable Set Solid"

Put PlataformaPrincipal sprite behavior "Set Solid Disable"

Variable PuertaPrincipal "Set Puerta = 1"

Variable PuertaLejos "Set Puerta = 1"

Character behavior Flash: "Flash 0.3 on 0.1 off 2"

PlataformaPrincipal "Set opacity 90"

With these actions, what we get is that when you play the character the tele-door transportation to rigs that are further away, and change its size, position where we want and put the opacity of the platforms that are ahead at 90 to are a bit transparent and see our player, we also changed the value of the variables so that if PuertaPrincipal collides with and not take any action affecting. The effect of "Flash" is not necessary, you can skip.

Click "Run layout" and check that we will touch the bottom but the top door does nothing, and if we touch the bottom door does nothing!

We will solve this by these conditions and actions so that when you touch the door down up.

3 In this line we get the following conditions and actions:

Conditions:

The conditions are: if the character collides with PuertaLejos and PuertaLejos local variable is = 1 then the actions are performed.

Actions:

Move the character to the layer "Principal"

Put the character in this position (150,120)

Put the character with this size (30,55) back to size!

Put PlataformaLejos sprite behavior "Set Solid Disabled"

Put PlataformaPrincipal sprite behavior "Enabled Set Solid"

Variable PuertaPrincipal “Set Puerta =0”

Variable PuertaLejos “Set Puerta =0”

Character behavior Flash: “Flash 0.3 on 0.1 off 2”

PlataformaPrincipal “Set opacity 100”

With this last line, we get that, if the character is in the layer “Lejos” and collides with PuertaLejos, for then would be in the main layer and again near!

Click "Run layout" and check and enjoy!

I hope you liked it and you've learned something ... I leave a link to where the tutorial if you have any questions ...

Forgiveness for my bad translation, I hope that the images do not be trouble understanding.

Here's an Example

A Salute!

Small notes: If you fall down, you only have to press F5, or you put it through a condition and action would be much more professional .. lol. You can also slow the character when you are away and replace normal speed when near ....

  • 0 Comments

Want to leave a comment? Login or Register an account!