Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning GDScript by Developing a Game with Godot 4
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning GDScript by Developing a Game with Godot 4

Learning GDScript by Developing a Game with Godot 4

By : Sander Vanhove
4.7 (12)
close
close
Learning GDScript by Developing a Game with Godot 4

Learning GDScript by Developing a Game with Godot 4

4.7 (12)
By: Sander Vanhove

Overview of this book

In the digital landscape driven by interactive experiences, the demand for creative individuals with the skills to create captivating games has never been higher. Written by Sander Vanhove, a seasoned game developer with over 20 games to his credit, this book will serve as your entry point into game development, showing you how to leverage the powerful features of the open-source, versatile GDScript 2.0 to develop your ideas, from simple platformers to complex RPGs. Whether you're an aspiring game developer, a hobbyist seeking a creative outlet, or simply someone intrigued by the world of game programming, this book will guide you through the intricacies of the Godot 4 game engine. Starting with a primer on the fundamentals of programming, you’ll cover everything from data to logic, while familiarizing yourself with Godot’s built-in tools such as the physics engine, navigation, and cameras. As you progress, you’ll unlock deeper insights into more advanced tools that will take your programming to the next level. Aided by easy-to-follow step-by-step tutorials, examples, exercises, and experiments, you’ll seamlessly integrate this newfound knowledge to create a Vampire Survivor-like game from scratch. By the end of this book, you’ll have become proficient in leveraging the Godot 4 game engine to bring your gaming visions to life.
Table of Contents (22 chapters)
close
close
1
Part 1:Learning How to Program
7
Part 2: Making a Game in Godot Engine
14
Part 3: Deepening Our Knowledge

Making a camera that follows the player

At the moment, our character can run around, but at some point, it will run off the screen and get lost forever. Our in-game camera should follow them around so the player knows where they are.

Luckily, the Godot Engine has a pretty nice camera system that we can use. It can be a bit basic, but it is all we need, and with some extra nodes, we’ll be able to achieve a very smooth-moving camera.

Setting up a basic camera

For 2D games, Godot provides the Camera2D node.

Open up the player.tscn scene and add a Camera2D node to the Player node. This is all we need to make a basic camera that follows the player:

Figure 9.1 – The player scene with an added Camera2D node

Figure 9.1 – The player scene with an added Camera2D node

But this basic camera feels a bit stiff; it starts and stops moving at exactly the moment the character does. This doesn’t feel very natural. Let’s see how to solve this.

Adding drag margins

To make the camera...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning GDScript by Developing a Game with Godot 4
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon