For weseewe of this game, I have done in a long time ago, but the comparison of rough, github.com/absolve/coc… I think I made it with Cocos2DX in my senior year, but it was ruined, so I left it there. Recently I made a new one with Godot, screenshot:

The above is the appearance of the game, there are some differences from the original game, some parts need to be optimized to be the same as the original game, Godot’s physics engine does not have rope joints, so some display effects are different, and there may be some bugs, so please let me know if you find any.

Now to start making the game, first of all, we need to create a new scene to make the game start screen and start screen. Only one scene is used to start and play the game, so one main screen is enough. Screenshot:

Note here that each section needs to be separated by the CanvasLayer component. The purpose is that when the player jumps, the camera will move according to the player’s position so that everything on the interface will move. The CanvasLayer can select objects that do not follow the camera.

The first is the production of the button. The button will have a color change effect when pressed. You only need to change the color in the pressed event.

Just create a basic button and reuse it. To create a moving block, use StaticBody2D to move the bottom block to the left. To create a continuous block, start by creating a block that covers the screen, and when the last block is on the screen, create a new block behind the last block. This function needs to send signals to achieve, so that you can know that you need to create a new block, between each block only two blocks can not stand, if more than two blocks can not jump, so you need to determine whether the first two blocks can not stand, specific can see the code.

It is the making of players’ blocks and the making of players’ KinematicBody2D, which can only jump. Beyond the screen, the game will end. The making is relatively simple, as it will rotate when jumping and return to normal when it is adjusted to the ground.

Camera to follow the change of the players jumping, the coordinates of the words as long as the judge players change, if the player over a distance y coordinates put players to the coordinates of the changes to the camera’s offset, in this case, the camera can follow the change of the players, the location of the need to keep the player square at the beginning, subsequent changes can be used to move the camera position.

UI animation production, mainly using AnimationPlayer for animation, it can add the properties of each object to the animation list, each animation can set the speed, you can manually control when to play. These animations can be used for various animation effects.

For sound playback, a new scene is set to singleton mode, only one file for background music, mainly by changing the playback speed to sound different songs, other sound effects are only played once and then stopped.

DampedSpringJoint2D is used because there is no joint of the rope. This is a spring, and you can set the deformation degree of the spring to control the change of the object. There is an idea here. So you need to set it in a different position.

The lines are drawn.

Basically, all objects are made in this way. For the dialog box inside, the dialog needs a background and text label, and the background needs to change with the background. The background can use NinePatchRect, and the outer panel can be used as the parent node and then set the size of margin to look centered.

There is a particle effect in the game, the particle effect is divided into two kinds, one is randomly generated from the right side, the other is the fireworks effect, the production method is relatively simple, first set a single particle, a new particle object, mainly set its properties,

The main idea is that particles have two behaviors, one is to fly up and one is to fall down. Finally, you just have to produce a lot of these particles. You can set the timer so that it generates from the right and at one point in large numbers, depending on the code.

Save game data, save game data using Godot functions can realize the function of saving data on multiple platforms, mainly to save data in JSON format in a file, so that the data can be directly read and parsed into objects. That’s the highest score in the game or something like that.

Game flow control. All the game logic is controlled in a file. State is set to control where the game is going. The process of the game itself is not complicated. In the game, if the player falls off the screen, the game ends. If the player gets 10 colors to complete the game, most of them can be controlled by setting the state value.

To generate a random array of colors, call the shuffle() function, which generates a random array.

Single title letters are created using rigidbody and set images, which can be set to clipped access, and then assembled together using DampedSpringJoint2D, put them out of the screen first, and let them fall free.

If there’s anything else, I’ll fill it in…

Project address: github.com/absolve/god…

Engine: godotengine.org/