Posts

Showing posts from March, 2021

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

Image
In this part, we will create a cannon and make it react to mouse movement. The behavior will be programmed in the cannon script. There are many ways to implement rotating by mouse logic and we will cover the most essential of them.  First, let's create a new 2d scene and call it Cannon . Attach a script to it, call it canon.gd Now add a Sprite and assign this texture to it The whole texture size is 128x128 but the round base size is 120 only. To make it rotating smoothly set Y offset to 4 Now spawn cannon scene to Game main scene Then set the cannon position to x: 512 and y: 80. Run the game. You should get this result Great! Now let's write the script and make it interactive! This is an important moment that the cannon's muzzle looks down (this is equal to Vector2.DOWN ). The programmed behavior depends on this and the program be a little different for the other directions.  Basically, all we need here is a couple of trigonometric functions .  Trigonometric funct...

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

Image
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 -> W...