Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 132 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,162 @@

_<h5 align="center">Learn how to make a game with the Godot Engine.</h5>_

## Summary
**<h2 align="center">1 - Getting Started with Godot</h2>**

- ### [0 - Empty Project]()
### Requirements

The course starting project, with empty folders and the project architecture.
Before following this course, if you are using this project as source code, run the following command :

- ### [1 - Getting Started with Godot]()
```bash
❯ git checkout 1-Getting-started-with-godot
```

Understanding the Godot node system, and getting started with the basics of scenes, and objects.
### Summary

- ### [2 - Player Movements]()
In this part we are going to see :

Implementing the basic movements that a player can have in a plateformer, such as moving right or left, and jumping.
- What are the purposes of each pannels in the Godot Game Engine
- How to nodes work in Godot
- How create our first scene and objects

- ### [3 - Level design]()
### Quick tour of Godot

Creating complex levels, with camera movements, and adding a link between each levels.
The Godot window can be divided into two main sections :

- ### [4 - Sprites and Animations]()
- The viewport in which we are going to edit our scenes and our scripts
- The docks in which we our going to create our nodes and edit our parameters

Making the game more appealing with some sprites and animations.
**Viewport**

- ### [5 - Tiles and Parrallax]()
The main view is the viewport. According to what we are going to edit, wether it is our levels or our scripts, this is the area that we will manipulate.

Improving the game aspect by adding tileset for our plateforms, parrallax in the background, lights and more.
![Viewport](assets/course/godot_viewport.png)

- ### [6 - Ennemies and player life]()
At the top of the viewport, you can see several options, such as select, move, rotate, scale, and others, that will come handy when manipulating our objects within our window.

Adding ennemies to the game and life to the player, adding collisions between enemies and player.
**Node dock**

- ### [7 - Screens and menus]()
The node dock is probably the most use dock in the application. This is where we are going to manipulate our objects hierarchy, in order to construct our scenes and levels, add properties to our objects, select the instances of the object that we want to manipulate, etc...

Adding screens to the game, such as the main menu, a game over screen, and a pause menu.
![Node Dock](assets/course/scene_nodes.png)

- ### [8 - Sounds and music]()
At the top of the scene, the chain icon is the button we are going to use in order to import objects in our scene.

Adding music and sounds to the game in order to give a player a better experience.
**File system**

- ### [9 - Backups and checkpoints]()
The file system is the place where we can select our elements to access them. It is also a useful help in order to know your project architecture.

Adding backups and checkpoints to load previous game, and checkpoints to ease the more complex levels.
![File system](assets/course/file_system.png)

- ### [10 - Export the game]()
It will be aspecially usefull when we will need to import our assets, as we will drag and drop them into our properties.

Exporting the game to different plateforms.
**Inspector**

## About this repository
The inspector is the section where we will edit our objects properties. It is also in the inpector that our custom properties will be added for our objects.

In order to follow this course, you can use a `git checkout <part>` with the branch name, if you didn't succeed to implement all the elements of the Mooc.
![Inspector](assets/course/inspector.png)

Each branch contains the assets needed for the part of the tutorial.
**Tool Bar**

## Contact
From left to right :

_For further questions about this repository, please contact me at **adechauveron@gmail.com**._
- The properties of our project
- The viewport navigation controller
- The game/scenes play button

![Tool bar](assets/course/control_bar.png)

> Before you go on to the next part, I strongly suggest you get familiar with all the dock's names in order not to be confused when they will be mentionned in the following parts of the course.

### Create a first scene

**Our first nodes**

Now that we know where to go in the game engine, it's time to create our first scene.

In the `node` dock, we are going to click on `2d scene`, and add two child nodes :

- A RigidBody2D
- A StaticBody2D

> The 2D nodes are represented in blue, and the 3D nodes are represented in red. As we are creating a 2D plateformer, all the nodes used should always be blue for our game objects.

For each child nodes, we are going to add two child nodes, a `Sprite` node, and a `CollisionShape2D` node.
If you did well, you should obtain the following tree :

![First nodes tree](assets/course/first_nodes_tree.png)

> Don't worry about the warning, we'll fix it later

**Objects, sprites, and collision shapes**

For now, we can't see our objects, let's add some sprites to them.

> Do all the following steps for one object then the other, otherwise you won't be able to see the two.

Let's start by our `RigidBody2D` object.

To do that, select the `sprite` node in the `node` dock, and let's drag and drop our [Godot character](assets/icons/icon.png) from our `filesystem` to our sprites nodes, in the `texture` property in the `inspector`.

We now can see our character !

![Icon to sprite](assets/course/icon_to_sprite.png)

Now let's deal with the warning of the `CollisionShape2D`, by clickin on it. In the `inspector`, click on the `shape` property, and select `New RectangleShape2D`.

A square should have appeared on your character, by draging the points, we can adjuste the collision area to match the size of our character.

![Collision Shape](assets/course/collision_shape.png)

Let's move away our character in order to leave some space to create the plateform, **but don't move the object just yet !** They are not bind together, and if you move the sprite, the collision shape or the root node, you will offset them.

Before you move them, you must click on the following button in your control pannel, above your viewport, make sure you have your base node selected (the `RigidBody2D` node).

![Glue Button](assets/course/glue_button.png)

You can save this object, move it, and repeat the instructions for the other object.

> Scale the sprite, and the collision shape to create a large plateform.

If you followed all the steps, you should be having a window looking like the following :

![Demo final state](assets/course/demo_final_state.png)

**Time has come to finally run our scene !**

To do that, click on the play scene button at the top right hand corner of your window.

![Play Scene Button](assets/course/play_scene_button.png)

> When you'll run the scenes, be carefull on which scene is beeing selected before you run it.

If you see a window pop up, and your character following until it reaches the plateform, **CONGRATULATION ! YOU MADE YOUR FIRST GAME !** Not that he is very intersting right now, but it's already a good start.

> If you didn't get the expected result, go back earlier in this tutorial to see if you didn't miss any step.

### Create our first objects

You just experimented with your first scenes and objects, but our games would be extremely complicated to create if every objects was created all the time in each levels.

This is why we our going to recreate the objects in separated scenes, and then import them in our demo scene.

**More scenes**

In Godot, everything is a scene. Therefor, we are going to create to more, but this time by right clicking each objects and selecting the `Save branch as scene`. Select the location at which you want to save your scene.

When we will create a new object in this scene, we will create a new scene, and use the `CustomNode` to select the root node of our object.

To import the objects in our levels, we will click on the `Instance a scene file as node` button.

![Instance scene as node button](assets/course/instance_scene_as_node.png)

### Conclusion

**Let's summer up what we learned :**

- **In Godot, every object is a scene containing a tree of nodes**
- **To create a new objet, we need to create a custom node at the root of our tree**
- **To import our objects, we need to instanciate them as nodes in our scenes**
- **Objects need sprites to be visible, and collision shapes to interact with each other.**

**In the [next part](https://github.com/Anatole-DC/godot_plateformer_tutorial/tree/2-Player-movements), we will see how to create our first player, and implement the basics movements.**
Empty file added assets/course/.gdignore
Empty file.
Binary file added assets/course/collision_shape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/control_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/demo_final_state.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/file_system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/first_nodes_tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/glue_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/godot_viewport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/icon_to_sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/inspector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/instance_scene_as_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/play_scene_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/course/scene_nodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions characters/player/TempDemoCharacter.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://assets/icons/icon.png" type="Texture" id=1]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 31.8445, 31.9464 )

[node name="TempDemoCharacter" type="RigidBody2D"]
position = Vector2( 530.497, 234.283 )
__meta__ = {
"_edit_group_": true
}

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

3 changes: 3 additions & 0 deletions default_env.tres
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[gd_resource type="Environment" load_steps=2 format=2]

[sub_resource type="ProceduralSky" id=1]

[resource]
background_mode = 2
background_sky = SubResource( 1 )

20 changes: 20 additions & 0 deletions items/plateforms/TempDemoPlatform.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://assets/icons/icon.png" type="Texture" id=1]

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 189.993, 32.2372 )

[node name="TempDemoPlatform" type="StaticBody2D"]
position = Vector2( 542.353, 481.703 )
__meta__ = {
"_edit_group_": true
}

[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 5.9375, 1 )
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )

37 changes: 37 additions & 0 deletions levels/DemoScene.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://assets/icons/icon.png" type="Texture" id=1]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 31.8445, 31.9464 )

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 189.993, 32.2372 )

[node name="DemoScene" type="Node2D"]

[node name="TempDemoCharacter" type="RigidBody2D" parent="."]
position = Vector2( 530.497, 234.283 )
__meta__ = {
"_edit_group_": true
}

[node name="Sprite" type="Sprite" parent="TempDemoCharacter"]
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="TempDemoCharacter"]
shape = SubResource( 1 )

[node name="TempDemoPlatform" type="StaticBody2D" parent="."]
position = Vector2( 542.353, 481.703 )
__meta__ = {
"_edit_group_": true
}

[node name="Sprite" type="Sprite" parent="TempDemoPlatform"]
scale = Vector2( 5.9375, 1 )
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="TempDemoPlatform"]
shape = SubResource( 2 )