00.flying-spaceship-your-first-scene-and-script

Flying spaceship: your first scene and script

Welcome to your first game project.

You’ve spent hours learning the basics of programming. Now, it’s time for things to get more fun: you will dive headfirst into game development.

You will learn by creating toys and mini-games in this part of the course. We will make many projects of varying sizes.

Through these projects, you will both reuse and build upon everything you learned in the Learn GDScript app.

Your first project: the spaceship

In this first project, we’ll make a spaceship you can control with the keyboard and make boost.

First, we will make it move and stop very sharply. Then, we’ll look at how we can use steering to make it move smoothly.

You will learn:

In the follow-along videos, we’ll first code a ship that moves by itself. We’ll then add player controls to the project’s input map and use input functions to code player controls. We’ll finally add the boost mechanic.

It’ll then be your turn to make the ship move smoothly using steering behaviors.

As this is your first project, the amount of information will likely be a bit overwhelming.

That’s normal: there’s so much to learn at first! We do not expect you to remember everything here.

We’re trying to create real game mechanics and give you a sense for how Godot works.

The key takeaways for this project are the concepts of scenes, nodes, signals, and scripts. After you complete the project, you’ll find a guide that goes deeper into them.

Also, you will see every feature introduced in this project again and again in the course, which will allow you to remember it all much better.

Of course, we have also included explanations of many other new concepts under each video.

Please head to the next lesson where we’ll start coding our spaceship together.

Importing the project

If you haven’t already, download the godot-practice-*.zip file and unzip it.

The course comes as zipped archives. To access the files, you need to extract them from the archives. Your system should come with a program that does that pre-installed.

To unzip the files:

  1. In your file explorer, navigate to the folder containing the downloaded file.
  2. Right-click the zip file and select the option saying “extract” (Windows, Linux). On macOS, you need to double-click the file instead.

You should see a new directory named like the zip archive. It contains the all the course files, for this tutorial and all the others.

Launch Godot, and in the project manager that opens, click Import.

Navigate to where you unzipped the project, enter the directory, and double-click project.godot.

Then, click on Import and Edit.

That’s it, you’ve imported the project!

Next time, you just need to select it in the list of projects:

Note: if you need it, the file godot-complete-demos-*.zip contains the completed code for all the tutorials (but not the practices).

How to follow every lesson

For every lesson, you should open the project “Learn to Code with Godot: Practices” in Godot. You should watch the video first if there’s one and then read the text. You should also follow along with the instructions and reproduce the scenes and code in Godot.

Our tutorials have three parts:

  1. We explain why we do what we’re doing. It can be tempting to skip this part, but please read it, we think it is important for your learning.
  2. We give you explanations for you to follow along and code for you to write. Resist the temptation to copy-paste. Programming is largely a matter of habits. Writing code repeatedly is essential for learning.
  3. We give you interactive practices to train new skills. They have headings like “Practice: …”. When you see them, you should open the indicated scene in Godot by clicking the corresponding practice in the GDQuest Practices dock on the right.

Locating the Lesson Files

To get started, open the project “Learn to Code with Godot: Practices” in Godot and, in the FileSystem dock, expand the MovingShip directory, then the 01.MakingShipMove directory, and double click MakingShipMove.tscn. See you in the tutorial!