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.
Si colocas algunos tiles cerca, te darás cuenta que si brincas en un tile desde abajo, tu cabeza chocará en él y volverá a caer. ¿Qué si quieres hacer plataformas donde puedas saltar desde abajo? Esto es lo que el comportamiento *Jump-thru hace. Como el comportamiento solido puedes estar parado en ella con el comportamiento Platform, pero el jugador podrá saltar a ella desde abajo
Vamos a hacer una version Jump-thru de nuestro objeto Tile. Click-derecho en el objeto Tile y selecciona Clone object type. Esto hará dos tipos de objeto separados, Tile2, que tiene distintos comportamientos. Elimina el comportamiento Solid y agrega el comporamiento Jump-thru.
Use tiles 134 and 135 to make a jump-thru like this:
Utiliza los tiles 134 y 135 para hacer un jump-thru como éste:
Run the game. Notice how you can jump on to it from underneath.
Ejecuta el juego. Te darás cuenta que puedes saltar desde abajo.
Hopefully you now know enough to design a whole level! Here's a zoomed out level design I put together quickly while writing the tutorial. It might help show you some of the possibilities. Notice the use of markers across platforms to keep the snails on their platforms.
¡Esperamos que ahora sepas lo suficiente para diseñar un nivel entero! Aquí hay un zoom del diseño del nivel que obtuve rápidamente mientras escribía éste turorial. Podría ayudar a mostrar algunas de las posibilidades. Observe el uso de los marcadores en las plataformas para mantener a los caracoles en sus plataformas moviendose de lado a lado.
Try adding a parallax effect to make the background seem further away. Select the Background layer in the layers bar. In the properties bar, set the Parallax property to 50, 50 (which means half speed scrolling). Notice how the background moves slower, giving a distance feel. Using multiple layers all with different parallax rates can create an almost 3D feel to a 2D game.
This tutorial covered a lot. You may want to revise it some time. Here are some of the key points:
- For the player's Platform behavior, always add the movement to an invisible box with no animations. Position the visible, animated player sprite on top of the box. This will prevent animations causing glitches in the platform movement.
- Levels can be built out of tiles.
- The Set mirrored action saves you having to make mirrored copies of all your animations.
- Animations sometimes need some work to get imported, set up with the right speed and looping properties, with the right origin set, and all frames cropped. You may also want to alter the collision masks, although this was not covered.
- Enemies can also be controlled with the Platform behavior. Set Default Controls to No and use the Simulate control action to automatically control movement.
- You can detect if the player is falling on an enemy rather than running in to them by testing if they are both falling and above the enemy on the Y axis when colliding. Otherwise (using 'Else'), they must be running in to the enemy, and they should get hurt.
- Instance variables can store numbers or text unique to each instance of an object. This helps control objects individually, which is useful for "AI".
- Edge markers are a quick and easy way to make enemies go back and forth on a platform.
- Jump-thru are platforms that can be jumped on to from underneath.
- Parallax is an easy and intriguing effect to add to platform games.
Obviously we have not made a full platform game! However, this tutorial has covered the most difficult bits, and the important essentials every platform game creator should know in advance. From here on hopefully you have an idea of how the rest of a platform game is going to come together. It takes time to get familiar with a complex development tool with Construct 2. However, experimenting can be fun, and teach you a lot! So spend a while playing around, breaking things, tweaking things, and see what you can come up with. Happy platforming!
You may be interested in the alternative beginner's guide, which is a tutorial to make a top-down shooter. It covers some different points like making a heads-up display, and goes in to instance variables in some more detail too. These are both things that can be applied to platform games, so it would definitely be useful to go through it in addition to this tutorial.
Want to add music and sound effects? See Sounds & Music in the manual.
If you'd like to know more about how events work in Construct 2, see the section on How Events Work in the manual. It's highly recommended so you can get going quickly with your own projects! Then for even more information, don't forget there is complete documentation in the manual.