Godot Engine Game Development Projects
eBook - ePub

Godot Engine Game Development Projects

Build five cross-platform 2D and 3D games with Godot 3.0

Chris Bradfield

Compartir libro
  1. 298 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Godot Engine Game Development Projects

Build five cross-platform 2D and 3D games with Godot 3.0

Chris Bradfield

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Create interactive cross-platform games with the Godot Engine 3.0About This Book• Learn the art of developing cross-platform games• Leverage Godot's node and scene system to design robust, reusable game objects• Integrate Blender easily and efficiently with Godot to create powerful 3D gamesWho This Book Is ForGodot Engine Game Development Projects is for both new users and experienced developers, who want to learn to make games using a modern game engine. Some prior programming experience is recommended.What You Will Learn• Get started with the Godot game engine and editor• Organize a game project• Import graphical and audio assets• Use Godot's node and scene system to design robust, reusable game objects• Write code in GDScript to capture input and build complex behaviors• Implement user interfaces to display information• Create visual effects to spice up your game• Learn techniques that you can apply to your own game projectsIn DetailGodot Engine Game Development Projects is an introduction to the Godot game engine and its new 3.0 version. Godot 3.0 brings a large number of new features and capabilities that make it a strong alternative to expensive commercial game engines. For beginners, Godot offers a friendly way to learn game development techniques, while for experienced developers it is a powerful, customizable tool that can bring your visions to life.This book consists of five projects that will help developers achieve a sound understanding of the engine when it comes to building games.Game development is complex and involves a wide spectrum of knowledge and skills. This book can help you build on your foundation level skills by showing you how to create a number of small-scale game projects. Along the way, you will learn how Godot works and discover important game development techniques that you can apply to your projects.Using a straightforward, step-by-step approach and practical examples, the book will take you from the absolute basics through to sophisticated game physics, animations, and other techniques. Upon completing the final project, you will have a strong foundation for future success with Godot 3.0.Style and approachThe book is divided into five parts; each covering a different small-game project using a straightforward, step-by-step approach and practical examples. The book will take readers from the absolute basics through sophisticated game physics, animation, and other techniques.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Godot Engine Game Development Projects un PDF/ePUB en línea?
Sí, puedes acceder a Godot Engine Game Development Projects de Chris Bradfield en formato PDF o ePUB, así como a otros libros populares de Computer Science y Programming Games. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2018
ISBN
9781788836425
Edición
1

Jungle Jump (Platformer)

In this chapter, you'll build a classic platform, style game in the tradition of Super Mario Bros. Platform games are a very popular genre, and understanding how they work can help you make a variety of different game styles. The physics of platformers can be deceptively complex, and you'll see how Godot's KinematicBody2D physics node has features to help you implement the character controller features you need for a satisfying experience. Take a look at the following screenshot:
In this project, you will learn about:
  • Using the KinematicBody2D physics node
  • Combining animations and user input to produce complex character behavior
  • Creating an infinitely scrolling background using ParallaxLayers
  • Organizing your project and planning for expansion

Project setup

Create a new project. Before you download the assets from the link that follows, you need to prepare the import settings for the game art. The art assets for this project use a pixel art style, which means they look best when not filtered, which is Godot's default setting for textures. Filtering is a method by which the pixels of an image are smoothed. It can improve the look of some art, but not pixel-based images:
It's inconvenient to have to disable this for every image, so Godot allows you to customize the default import settings. Click on the icon.png file in the FileSystem dock, then click the Import tab next to the Scene tab on the right. This window allows you to change the import settings for the file you've selected. Uncheck the Filter property, then click Preset and choose Set as Default for 'Texture'. This way, all images will be imported with filtering disabled. Refer to the following screenshot:
If you've already imported images, their import settings won't be updated automatically. After changing the default, you'll have to reimport any existing images. You can select multiple files in the FileSystem dock and click the Reimport button to apply the settings to many files at once.
Now, you can download the game assets from the following link and unzip them in your project folder. Godot will import all the images with the new default settings, https://github.com/PacktPublishing/Godot-Game-Engine-Projects/releases
Next, open Project | Project Settings and under Rendering/Quality, set Use Pixel Snap to On. This will ensure that all images will be aligned properly—something that will be very important when you're designing your game's levels.
While you have the settings window open, go to the Display/Window section and change Stretch/Mode to 2d and Aspect to expand. These settings will allow the user to resize the game window while preserving the image's quality. Once the project has been completed, you'll be able to see the effects of this setting.
Next, set up the collision layer names so that it will be more convenient to set up collisions between different types of objects. Go to Layer Names/2d Physics and name the first four layers like this:
Finally, add the following actions for the player controls in the Input Map tab under Project | Project Settings:
Action Name Key(s)
right D, →
left A, ←
jump Space
crouch S, ↓
climb W, ↑

Introducing kinematic bodies

A platform game requires gravity, collisions, jumping, and other physics behavior, so you might think that RigidBody2D would be the perfect choice to implement the character's movement. In practice, however, you'll find that the realistic physics of the rigid body are not desirable for a platform character. To the player, realism is less important than responsive control and an action feel. As the developer, you therefore want to have precise control over the character's movements and collision response. For this reason, a kinematic body is usually the better choice for a platform character.
The KinematicBody2D node is designed for implementing bodies that are to be controlled directly by the user or via code. These nodes detect collisions with other bodies when moving, but are not affected by global physics properties like gravity or friction. This doesn't mean that a kinematic body can't be affected by gravity and other forces, just that you must calculate those forces and their effects in code; the engine will not move a kinematic body automatically.
When moving KinematicBody2D, as with RigidBody2D, you should not set its position directly. Instead, you use either the move_and_collide() or move_and_slide() methods. These methods move the body along a given vector and instantly stop if a collision is detected with another body. After KinematicBody2D has collided, any collision response must be coded manually.

Collision response

After a collision, you may want the body to bounce, to slide along a wall, or to alter the properties of the object it hit. The way you handle collision response depends on which method you used to move the body.

move_and_collide

When using move_and_collide(), the function returns a KinematicCollision2D object upon collision. This object contains information about the collision and the colliding body. You can use this information to determine the response. Note that the function returns null when the movement was completed successfully with no collision.
For example, if you want the body to bounce off of the colliding object, you could use the following script:
extends KinematicBody2D var velocity = Vector2(250, 250) func _physics_process(delta): var collide = move_and_collide(velocity * delta) if collide: velocity = velocity.bounce(collide.normal)

move_and_slide

Sliding is a very common option for collision response. Imagine a player moving along walls in a top-down game or running up and down slopes in a platformer. While it's possible to code this response yourself after using move_and_collide(), move_and_slide() provides a convenient way to implement sliding movement. When using this method, the body will automatically slide along the colliding surface. In addition, sliding collisions allow you to use metho...

Índice