chore: update readme

This commit is contained in:
Tybo Verslype 2024-04-18 17:08:49 +02:00
parent d86038b9c1
commit 74f3c22ece

View file

@ -8,8 +8,8 @@ An example solution will be released so that you can compare it to yours. We've
## Overview ## Overview
Let's have a look at the files. Let's have a look at the files (At the bottom left).
We start with We start with
- `Main.tscn` -> Main scene - `Main.tscn` -> Main scene
- `Main.gd` -> Script accompanying the main scene - `Main.gd` -> Script accompanying the main scene
@ -24,7 +24,7 @@ We'll split the main goal of making Flappy Bird into a few smaller goals, the fi
#### Player #### Player
Open up the player scene and it's accompanying script (`player.tscn` and `player.gd`). Open up the player scene and it's accompanying script (`player.tscn` and `player.gd`) by clicking at the player.tscn file at the bottom left.
If you look at the left side of the screen you'll notice we only have an `Area2D`, a `Sprite2D` and an `AnimationPlayer` node. As you can guess the latter will provide us with an animation. The player still misses a hitbox, let's add it by adding a `CollisionShape2D` node. Right click `Area2D` -> Add Child Node -> Select `CollisionShape2D`. The next step is making sure the hitbox resembles the bird. We can specify the hitbox by clicking on `CollisionShape2D` and opening the `Inspector` tab on the right hand side. There we can select the shape and specify the dimensions. At the top of your screen,press on `2D` so that we can see the hixbox. Now select a `CapsuleShape` as shape and change the `Radius` and `height` accordingly. If you can't see the `Radius` and `Height` options press on the little circle next to `CapsuleShape`. If you look at the left side of the screen you'll notice we only have an `Area2D`, a `Sprite2D` and an `AnimationPlayer` node. As you can guess the latter will provide us with an animation. The player still misses a hitbox, let's add it by adding a `CollisionShape2D` node. Right click `Area2D` -> Add Child Node -> Select `CollisionShape2D`. The next step is making sure the hitbox resembles the bird. We can specify the hitbox by clicking on `CollisionShape2D` and opening the `Inspector` tab on the right hand side. There we can select the shape and specify the dimensions. At the top of your screen,press on `2D` so that we can see the hixbox. Now select a `CapsuleShape` as shape and change the `Radius` and `height` accordingly. If you can't see the `Radius` and `Height` options press on the little circle next to `CapsuleShape`.
Now that the player has a sprite and hitbox let's implement the required logic. Now that the player has a sprite and hitbox let's implement the required logic.
@ -54,7 +54,7 @@ We don't have a tower scene yet so let's add one!
At the bottom left right click and add a new scene. Select 2D Scene and give it the name Tower At the bottom left right click and add a new scene. Select 2D Scene and give it the name Tower
As you can see we start with a single node. As you can see we start with a single node.
A tower consists of 2 parts, an upper pipe and a lower pipe. As we want the pipes to be rigid bodies we'll use `RigidBody2D`. Add 2 of those, one for the upper half and one for the lower. A tower consists of 2 parts, an upper pipe and a lower pipe. We'll use `RigidBody2D`. Add 2 of those, one for the upper half and one for the lower.
let's give the upper pipe a texture. let's give the upper pipe a texture.
Add a `Sprite2D` to the `RigidBody2D`. In the `Inspector` tab you'll see an empty texture field. Give it a texture by pressing on empty -> select Load -> select sprites.png inside the directory res. Add a `Sprite2D` to the `RigidBody2D`. In the `Inspector` tab you'll see an empty texture field. Give it a texture by pressing on empty -> select Load -> select sprites.png inside the directory res.
@ -101,3 +101,6 @@ You should now have a fully functioning game.
Although the game works there are some minor issues. Although the game works there are some minor issues.
we keep building towers but we never remove them! we keep building towers but we never remove them!
Remove any tower that is no longer on the screen, this time without Todo's :) Remove any tower that is no longer on the screen, this time without Todo's :)
Also the game runs framerate dependant now, when you have a higer frame rate you bird drops like a stone.
Make the game framerate independant.