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 : Vanhove
4.8 (10)
close
close
Learning GDScript by Developing a Game with Godot 4

Learning GDScript by Developing a Game with Godot 4

4.8 (10)
By: 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

Fixing the timer and end game

The last thing we need to adjust for multiplayer is the timer that times our run and the end of the game, stopping the entity spawners and showing the game-over menu. So, let’s get started on this last effort.

Synchronizing the timer

To synchronize the score timer, we simply have to do the following three things:

  1. Add MultiplayerSynchronizer to the main.tscn scene.
Figure 11.26 – The Main scene tree after adding MultiplayerSynchronizer

Figure 11.26 – The Main scene tree after adding MultiplayerSynchronizer

  1. Synchronize the _time property of the Main node.
Figure 11.27 – The Replication panel tracking the _time property of the Main node

Figure 11.27 – The Replication panel tracking the _time property of the Main node

  1. Now, disable the _process() function from within _ready() if we are not running on the server:
    func _ready():
       # Other code
       if not multiplayer.is_server():
          set_process(false)

That is all we need to do synchronize...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

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