Beginning Game Development with Godot (for John Malkovec): Learn to Create and Publish Your First 2D Platform Game Maithili Dhule
Visit to download the full and correct content document: https://ebookmass.com/product/beginning-game-development-with-godot-for-john-ma lkovec-learn-to-create-and-publish-your-first-2d-platform-game-maithili-dhule/

More products digital (pdf, epub, mobi) instant download maybe you interests ...

Multiplayer Game Development with Unreal Engine 5 (for John Malkovec) Marco Secchi
https://ebookmass.com/product/multiplayer-game-development-withunreal-engine-5-for-john-malkovec-marco-secchi/

Flame Game Development: Your Guide to Creating Crossplatform Games in 2D Using Flame Engine in Flutter 3 Andrés Cruz Yoris
https://ebookmass.com/product/flame-game-development-your-guideto-creating-cross-platform-games-in-2d-using-flame-engine-influtter-3-andres-cruz-yoris/

Flame Game Development: Your Guide to Creating CrossPlatform Games in 2D Using Flame Engine in Flutter 3 1st Edition Andrés Cruz Yoris
https://ebookmass.com/product/flame-game-development-your-guideto-creating-cross-platform-games-in-2d-using-flame-engine-influtter-3-1st-edition-andres-cruz-yoris/

Programming for Game Design: A Hands-On Guide with Godot 1st Edition Wang
https://ebookmass.com/product/programming-for-game-design-ahands-on-guide-with-godot-1st-edition-wang/

Programming for Game Design: A Hands-On Guide with Godot 1st Edition Wallace Wang
https://ebookmass.com/product/programming-for-game-design-ahands-on-guide-with-godot-1st-edition-wallace-wang/

Programming for Game Design: A Hands-On Guide with Godot 1st Edition Wallace Wang
https://ebookmass.com/product/programming-for-game-design-ahands-on-guide-with-godot-1st-edition-wallace-wang-2/

Game Backend Development: With Microsoft Azure and PlayFab Balint Bors
https://ebookmass.com/product/game-backend-development-withmicrosoft-azure-and-playfab-balint-bors/

Introduction to Java Through Game Development: Learn Java Programming Skills by Working with Video Games 1st Edition Victor G. Brusca
https://ebookmass.com/product/introduction-to-java-through-gamedevelopment-learn-java-programming-skills-by-working-with-videogames-1st-edition-victor-g-brusca/

Work on Your Game: Use the Pro Athlete Mindset to Dominate Your Game in Business, Sports, and Life Dre Baldwin
https://ebookmass.com/product/work-on-your-game-use-the-proathlete-mindset-to-dominate-your-game-in-business-sports-andlife-dre-baldwin/

Maithili Dhule
Beginning Game Development with
Godot
Learn to Create and Publish Your First 2D
Platform Game

Maithili Dhule
Singapore, Singapore
ISBN 978-1-4842-7454-5 e-ISBN 978-1-4842-7455-2
https://doi.org/10.1007/978-1-4842-7455-2
© Maithili Dhule 2022
Standard Apress
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the bene it of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identi ied as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional af iliations. This Apress imprint is published by the registered company APress Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.
Dedicated to all aspiring game developers!
Introduction
Game development is a journey of discovery and creation—it’s an art, really. With the right tools and knowledge, we can all be artists. What makes it remarkable is that it welcomes people with all kinds of talents; you can be a coder who makes the program work, you can be a designer who creates game characters and builds the game world, you can be a musician who adds music and sound effects, or you can be someone who does all of that! It gives you the chance to either work independently (earning the cool title of indie game developer!) or collaborate with other talented individuals.
Surprisingly, some of the very best games out there start with small teams or are created by just a single person. But this has the incredible advantage of giving you the opportunity to learn more. This is where books and resources on game development, such as this one, come into the picture.
I would like to take a moment to thank you, reader, for picking up this book. We’ll begin our learning journey together. While some of us may be just starting out in game development, some among us may be seasoned programmers who want to get a solid understanding of the basics of making 2D games with Godot. Here’s a glimpse into what comes next:
We’ll …
Briefly talk about some design principles that are used by famous games to make them fun to play. We’ll discuss game engines and what makes Godot a great one for beginners and experts alike.
Get comfortable with navigating around the Godot interface, and brush over the basics of GDScript, the main scripting language used in Godot.
Play around with game physics and use the related concepts to animate and control our game character.
Design the entire 2D game world, adding different collectibles that the player can collect and introduce enemies that the player can defeat.
Create a simple system to keep track of the player’s score and lives, and create a mechanism to reload a scene if a player falls off a cliff or to load the Game Over scene if the player loses the game.
Add some cool music and sound effects to our game, and design the GUI for various game screens such as the title screen.
Export our games to various platforms such as mobile (Android), PC (Windows), and the browser.
Learn ways to publish and monetize our game.
Now, let’s dive right into making our first 2D platformer in Godot!
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book’s product page, located at www.apress.com/978-1-48427454-5. For more detailed information, please visit www.apress.com/source-code.
Acknowledgments
“If I have seen further than others, it is by standing on the shoulders of giants.”
Sir Isaac Newton
Here I am today, the author of a book on a topic I enjoy immensely game development. There are quite a lot of people I am grateful for, for helping make this book come to fruition.
I would like to thank my family for being supportive and patient and for motivating me while I spent back-breaking hours working on the manuscript.
I am grateful for my friends (all around the world!) for making me laugh and smile and for always believing in me.
I feel lucky to have been taught by so many wonderful teachers over the years. Thank you for teaching me, inspiring me, and making me capable to enough to write a book!
I am also immensely grateful to my acquisition editor, Spandana Chatterjee, for giving me this opportunity to combine my passion for writing and making games. I would also like to thank my technical editor, John Wigg, for taking the effort to go through the entire book and suggesting valuable feedback.
Moreover, I am thankful to Divya Modi, Laura Berendson, and the rest of the Apress team for your collaboration and help.
Thank you all for making my dream a reality!
Table of Contents
Part I: The Art of Creating Games
Chapter 1: Introduction
The Birth of Video Games
Principles of Game Design
Game Progression
Put the Player in Control
Give the Player Choices
Create Immersive Scenarios
Have a Creative Vision
What Is a Game Engine?
How Do We Choose a Game Engine?
Why Choose Godot?
The Graphics Engines Are Amazing
It’s Easy on the Eyes
It’s Open Source
It Can Be Run on Multiple Platforms
It Supports Live Editing
It Has Its Own Scripting Language
There Is a Vast Community Support
The Documentation Is Extensive
You Can Tinker with It
Teamwork Is a Breeze
It’s “MegaByte”-Sized
Key Takeaways
Part II: Starting Out with Godot
Chapter 2: Getting Started with Godot
Downloading the Engine
Creating a New Project
Exploring the Engine Interface
FileSystem
Scene Dock
Inspector Dock
Workspaces
Animation Panel
SpriteFrames Panel
Output Panel
Debugger Panel
Audio Panel
2D Toolbar
Playtest Buttons
Tips and Shortcuts
Key Takeaways
Chapter 3: GDScript in a Nutshell
What Is GDScript?
Scripting
Variables and Data Types
Integer
Float
Boolean
String
Declaring a Variable
Explicit and Inferred Typing
Constants
Enums
Keywords
Comments
Output Functions
Array
Random Number Generation
Operators and Computation
Mathematical Operators
Comparison and Logical Operators
if-else Statements
Dictionaries
Looping for Loop while Loop
Key Takeaways
Chapter 4: Exploring Game Physics
Collision Objects
The Node-Scene Architecture
Adding Nodes to the Scene
Creating a Rigid Body
Adding a Sprite Node
Adding a Collision Shape
Playing Your First Scene
Properties of RigidBody2D
Duplicating a Node
Creating a Static Body
Key Takeaways
Part III: Designing the Game
Chapter 5: Adding Game Graphics
What Are Game Assets?
OpenGameArt.org
Itch.io
Gameart2D
Kenney.nl
Choosing the Right Assets
Importing Game Art
Creating the Main Game Scene
Creating Game Objects as Scenes
Designing the Main Game Scene
Creating the Player
Linking the Player to the Main Scene
Moving the Player Using Keyboard Input
Assigning Keyboard Input
Adding a Background Image
Key Takeaways
Chapter 6: Game Animations
Giving Life to the Player
Importing Images for Animation
Animating the Player
Creating Animations with Individual Images
Idle Animation
Run Animation
Jump Animation
Other Player Actions
Creating Animations Using a Sprite Sheet
Introduction to Godot’s Animation Player
Key Takeaways
Chapter 7: Building the Game World
Importing the TileMaps
Creating Individual Tiles
Camera-Follow
Creating a Parallax Background
Design Ideas
Key Takeaways
Chapter 8: Counting Wins and Losses
Adding Coins to the Game
Animating the Coin
Creating a Coin in the Game Level
Collecting Coins
Collecting the Coin Using Signals
Creating More Collectibles
Adjusting the Rewards
Adding Enemies
Detecting Ledges with a Raycast
Colliding with the Enemy
Collision Layer and Collision Mask
Player
Enemy
Coin
Detecting Falls
Changing Scenes
Fall Area and Finish Level Area Collision
Key Takeaways
Part IV: Game Enhancements and Export
Chapter 9: Game GUI
Creating the HUD
HBoxContainer and VBoxContainer
Creating a Script for the HUD
Custom Signals for Coin Collection
Displaying the Player’s Lives
Turning the Player Red on Getting Hurt
Creating the Title Screen
Background
Adding Text
Adding a Panel
Adding Buttons
Attaching a Script to a Button
Adding an Image to the Title Screen
The Game Over Screen
Adding Music to the Game
Adding Sound Effects
Jumping
Coin Collected
Key Takeaways
Chapter 10: Publishing Your Game
Game Enhancements
Creating Global Variables
Defeating the Monsters
Adding Touchscreen Buttons
Exporting Your Game
Downloading Export Templates
Exporting to PC (Windows)
Exporting to Mobile (Android)
Exporting to Browser (HTML)
Publishing Your Game
Itch.io
Exporting Tips
Monetizing Your Game
What’s Next?
Key Takeaways
Index