Learning GDScript by Developing a Game with Godot 4 A Fun Introduction to Programming in GDScript 2. 0 and Game Development Using the Godot Engine

Learn the Godot 4 game engine and GDScript 2.0 as you build your own game and transform into a proficient programmer with this illustrated guide Key Features Learn the fundamentals of programming as you write GDScript 2.0 Explore the world of GDScript 2.0 with this comprehensive introduction to the...

Descripción completa

Detalles Bibliográficos
Autor principal: Vanhove, Sander (-)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham : Packt Publishing, Limited 2024.
Edición:1st ed
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009820531706719
Tabla de Contenidos:
  • Cover
  • Title page
  • Copyright and credits
  • Dedication
  • Contributors
  • Table of Contents
  • Preface
  • Part 1: Learning How to Program
  • Chapter 1: Setting Up the Environment
  • Technical requirements
  • Godot game engine and open-source software
  • Some background on the engine
  • What is open-source software?
  • Getting and preparing Godot
  • Downloading the engine
  • Creating a new project
  • Light mode
  • Creating the main scene
  • A brief UI overview
  • Writing our first script
  • The Godot Engine Documentation
  • Join our community!
  • Summary
  • Quiz time
  • Chapter 2: Getting Familiar with Variables and Control Flow
  • Technical requirements
  • What are variables?
  • Variables - Drawers in a filing cabinet full of data
  • Naming variables
  • Variables in GDScript
  • Printing out variables
  • Changing a variable's value
  • Mathematical operators
  • Other assignment operators
  • Data types - Integers, floats, and strings
  • Integers
  • Floats
  • Strings
  • What are constants?
  • Constants in GDScript
  • Magic numbers
  • Creating new scenes
  • Getting started with control flow
  • The if statement
  • The if-else statement
  • The elif statement
  • Commenting in code
  • Indentation
  • Boolean logic
  • The match statement
  • The ternary-if statement
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 3: Grouping Information in Arrays, Loops, and Dictionaries
  • Technical requirements
  • Arrays
  • Creating an array
  • Accessing values
  • Accessing elements backward
  • Changing the elements of an array
  • Data types in arrays
  • Strings are secretly arrays
  • Manipulating arrays
  • Don't be scared of errors or warnings
  • Loops
  • For loops
  • While loops
  • Continuing or breaking a loop
  • Dictionaries
  • Creating a dictionary
  • Data types in dictionaries
  • Accessing and changing values.
  • Creating a new key-value pair
  • Useful functions
  • Looping through dictionaries
  • Nested loops
  • Null
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 4: Bringing Structure with Methods and Classes
  • Technical requirements
  • Methods are reusable bits of code
  • What is a function?
  • Defining a function
  • Naming a function
  • The return keyword
  • The pass keyword
  • Optional parameters
  • Classes group code and data together
  • Defining a class
  • Instancing a class
  • Naming a class
  • Extending a class
  • Each script is a class!
  • When are certain variables available?
  • The scope of a function
  • Types help us to know how to use a variable
  • What is type hinting?
  • Type hinting variables
  • Type hinting arrays
  • Learning about the Variant type
  • Type hinting function parameters
  • Type hinting function returns
  • Using void as a function return
  • Inferred types
  • null can be any type
  • Autocompletion
  • Using type hinting for named classes
  • Performance
  • Editor adding type hints
  • OOP primer
  • Inheritance
  • Abstraction
  • Encapsulation
  • Polymorphism
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 5: How and Why to Keep Your Code Clean
  • Technical requirements
  • Back to naming things
  • Naming conventions
  • General naming tips
  • Public and private class members
  • Make short functions
  • DRY
  • Do one thing (KISS)
  • Defensive programming
  • Programming style guides
  • White spacing
  • Blank lines
  • Line length
  • Utilizing the documentation
  • Accessing a class's documentation
  • Directly accessing a function or variable's documentation
  • Going to the definition of a function or variable
  • Searching the documentation
  • Accessing the online documentation
  • Summary
  • Quiz time
  • Part 2: Making a Game in Godot Engine.
  • Chapter 6: Creating a World of Your Own in Godot
  • Technical requirements
  • Game design
  • Genre
  • Mechanics
  • Story
  • Creating a player character
  • Adding a sprite
  • Displaying health
  • Manipulating nodes in the editor
  • Creating the player script
  • Referencing nodes in a script
  • Caching node references
  • Trying out the player script
  • Exporting variables to the editor
  • Setters and getters
  • Changing values while the game is running
  • Different types of exported variables
  • Creating a little world
  • Changing the background color
  • Adding Polygon2D boulders
  • Node drawing order
  • Creating an outer wall
  • Getting creative
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 7: Making the Character Move
  • Technical requirements
  • Vector math refresher
  • The 2D coordinate system
  • What is a vector?
  • Scaling vectors
  • Adding and subtracting vectors
  • More vector operations
  • Moving the player character
  • Changing the current player node
  • Applying forces to the player
  • Process and physics process functions
  • Mapping input
  • Using the input
  • Smoothing out the movement
  • Debugging a running game
  • Breakpoints
  • Remote tree
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 8: Splitting and Reusing Scenes
  • Technical requirements
  • Saving a branch as a new scene
  • Creating a separate player scene
  • The root node of a scene
  • Using saved scenes
  • Organizing scene files
  • Additional exercises - Sharepening the axe
  • Summary
  • Quiz time
  • Chapter 9: Cameras, Collisions, and Collectibles
  • Technical requirements
  • Making a camera that follows the player
  • Setting up a basic camera
  • Adding drag margins
  • Making the camera look ahead
  • Smoothing out the look ahead
  • Collisions
  • The different physics bodies
  • The Area2D node.
  • Adding a collision shape to the player node
  • Creating static bodies for the boulders
  • Creating static bodies for the walls
  • Creating collectibles
  • Creating the base collectible scene
  • Inheriting from a base scene
  • Connecting to a signal
  • Writing the code for collectibles
  • Using collision layers and masks
  • Your turn!
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 10: Creating Menus, Making Enemies, and Using Autoloads
  • Technical requirements
  • Creating a menu
  • Control nodes
  • Creating a basic start menu
  • Setting the main scene
  • Making enemies
  • Constructing the base scene
  • Navigating enemies
  • Writing the enemy script
  • Damaging the player in a collision
  • Spawning enemies and collectibles
  • Making a Game Over screen
  • Shooting projectiles
  • Creating the base scene
  • Writing the logic of the projectile
  • Spawning projectiles
  • Storing highscores in autoloads
  • Using an autoload
  • Creating a HighscoreManager autoload
  • Autoloads in the remote tree
  • Adding a UI in the main menu and game scene
  • Using the highscore in the main menu
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 11: Playing Together with Multiplayer
  • Technical requirements
  • A crash course in computer networking
  • What is a Transport Layer?
  • What is an Application Layer?
  • Networking in Godot Engine
  • Learning about IP addresses
  • Using port numbers
  • Setting up the base networking code
  • Creating the client-server connection
  • Adding UI
  • Running multiple debug instances at the same time
  • Synchronizing different clients
  • Updating the player scene for multiplayer
  • Synchronizing EntitySpawner
  • Synchronizing the enemy and collectibles
  • Synchronizing the projectile
  • Fixing the timer and end game
  • Synchronizing the timer.
  • Synchronizing the end of the game
  • Running the game on multiple computers
  • Showing the IP address of the server
  • Connecting from another computer
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Part 3: Deepening Our Knowledge
  • Chapter 12: Exporting to Multiple Platforms
  • Technical requirements
  • Exporting for Windows, Mac, and Linux
  • Downloading the export template
  • Making the actual exports of the game
  • Uploading our game to Itch.io
  • What is Itch.io?
  • Exporting our game to the web
  • Uploading to Itch.io
  • Exporting our game to other platforms
  • Mobile platforms
  • Consoles
  • Summary
  • Quiz time
  • Chapter 13: OOP Continued and Advanced Topics
  • Technical requirements
  • The super keyword
  • Static variables and functions
  • Enumerations
  • Lambda functions
  • Creating a lambda function
  • Where to use lambda functions
  • Passing parameters by value or reference
  • Passing by value
  • Passing by reference
  • The @tool annotation
  • Summary
  • Quiz time
  • Chapter 14: Advanced Programming Patterns
  • Technical requirements
  • What are programming patterns?
  • Exploring the Event Bus
  • The problem
  • The solution
  • Understanding Object Pooling
  • The problem
  • The solution
  • Implementing the Object Pool in our game
  • Working with State Machines
  • The problem
  • The solution
  • An example state
  • Additional exercises - Sharpening the axe
  • Summary
  • Quiz time
  • Chapter 15: Using the File System
  • Technical requirements
  • What is the file system?
  • File paths
  • User path
  • Creating a save system
  • Writing data to the disk
  • Reading data from disk
  • Preparing the save manager for use in the game
  • Adjusting the game to use the save manager
  • Having a look at the save file
  • Summary
  • Quiz time
  • Chapter 16: What Next?
  • Ideas for your next projects
  • Starting a new project.
  • Extending the survivor-like game.