SDL3 Oyun Programlama ve Godot Oyun Motoru sayfalarımız yayında...

Ana sayfa > Oyun programlama > Godot game engine > Addig dynamic platform

Addig dynamic platform

To add a moving platform to the game, follow the steps below:

1. While the "game" tab is selected, drag the "scenes/platform.tscn" file from the "FileSystem" tab and drop it to the left side of the scene.

2. While the "Platform2" Node is selected, create a new Node by clicking the + sign under the Scene tab or by pressing the Ctrl-A key combination.

3. In the Create New Node window that appears, search for and select AnimationPlayer in the Search line and click on the Create button.

4. While the "AnimationPlayer" Node is selected, click on the "Animation" statement in the window below the Godot development environment and select the "New" option.

5. In the window that appears, write "move" in the box and click the OK button.

6. While the "Platform2" Node is selected. Under the "Inspector" tab, in the "Transform" content, click on the key icon on the right side of the "Position" line.

7. In the box that appears, click the "Create" button.

8. Make the following arrangements:

  • In the "Add Track" row, drag and drop the blue vertical Timeline bar to column 1.
  • Drag the platform we placed on the stage to the far right.
  • Create a second keyframe by clicking the key icon again.

When you click the Run button, the animation plays. When you click the Loop button, it goes from the beginning to the end, and when it reaches the end, it goes back to the beginning and continues. When you click the same button again, when the Platform reaches the end, it moves backwards and comes back to the beginning.

9. Make the following adjustments:

  • Slow down the animation by making the value to the left of the Loop button 1.5.
  • Move the last keyframe point to 1.5 on the ruler.
  • Click the Autoplay button and enable automatic play.

The animation window image will be as follows.

10. Save the scene with Ctrl-S and run the game. The platform constantly moves between two points.