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

Condividi libro
  1. 298 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Godot Engine Game Development Projects

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

Chris Bradfield

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul 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.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Godot Engine Game Development Projects è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Godot Engine Game Development Projects di Chris Bradfield in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Programming Games. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781788836425
Edizione
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...

Indice dei contenuti