Peggle game in Godot 3 > Tutorial 01 - Create a new project

Hello, everyone! Peggle is an awesome game. It looks simple but it's so engaging and entertaining. If you have never played it, I strongly recommend trying it. You will like it. Also, there is a new version called Peggle Blast for mobile platforms, but I played the old PC version and will base this tutorial on that experience. 




The main goal is to implement the core mechanics that the original Peggle game has.  In this tutorial series, I will reveal the creating process and hope it will be interesting for you. Let's call our clone version of the game Pegball. Sounds cool, isn't it?

Ok, let's start. As you may guess already,  we will use Godot Engine. It's free, open-source, and has many cool features. If you don't have it, just download it. The current version of the engine is 3.2. 

Start Godot and create a new project.  For the project name let's go with Pegball Tutorial:


 First, Go to Project -> Project Settings -> Display -> Window and set width and height to 1024 and 768.


Now, create a new 2d scene and call it Game. Start the project, Godot will ask you about the default (main) scene - choose Game scene.


How to set default (main) scene in Godot

Start the game -> Godot asks about the default scene -> choose the scene
OR
Go to Project -> Project Settings -> General tab -> Application -> Run -> set Main Scene

After this, the game starts and you see a window filled with grey color. Nice 🙂!


Now let's change the background color from grey to white.  There are few ways to do so - in project settings or by script. 

How to set background color in Godot

Go to Project -> Project Settings -> General tab -> Rendering -> Environment -> set Default Clear Color

also you can
Go to Project -> Project Settings -> General tab -> Application -> Boot Splash -> set Bg Color to change color of the load screen

This way works well, but it also changes the background for the editor itself.
Let's go by another way and add a script to Game scene:

     

In this script, we will write the main game logic and everything that need to make the game working. For now, just let's change the default background color to white. It can be any color you want, but actually, it will have no sense as soon as the game be filled with graphics.  


extends Node2D

func _ready():
	VisualServer.set_default_clear_color(Color(1,1,1))

How to set background color in Godot (by script)

In the game's main scene add this code:
VisualServer.set_default_clear_color(Color(1,1,1))

Now run the game, the window should have white color:



This tutorial part source code on GitHub:

Comments

Popular posts from this blog

Peggle game in Godot 3 > Tutorial 02 - Rotate cannon by mouse move

My Vocabulary App Privacy Policy