Ensimmäinen 3D-pelisi

Tässä vaiheittaisessa opetussarjassa luot ensimmäisen täydellisen 3D-pelisi Godotilla. Sarjan loppuun mennessä sinulla on yksinkertainen mutta valmis projekti, kuten alla oleva animoitu gif.


Peli, jota koodaamme tässä, on samanlainen kuin doc_your_your_first_2d_game, mutta siinä on eräs käänne: voit nyt hypätä ja tavoitteesi on murskata hiipparit. Näin sekä tunnistat edellisessä opetusohjelmassa oppimasi mallit että rakennat niiden päälle uutta koodia ja ominaisuuksia.

You will learn to:

  • Work with 3D coordinates with a jumping mechanic.

  • Use kinematic bodies to move 3D characters and detect when and how they collide.

  • Use physics layers and a group to detect interactions with specific entities.

  • Code basic procedural gameplay by instancing monsters at regular time intervals.

  • Design a movement animation and change its speed at run-time.

  • Draw a user interface on a 3D game.

And more.

This tutorial is for beginners who followed the complete getting started series. We'll start slow with detailed instructions and shorten them as we do similar steps. If you're an experienced programmer, you can browse the complete demo's source code here: Squash the Creep source code.


You can follow this series without having done the 2D one. However, if you're new to game development, we recommend you to start with 2D. 3D game code is always more complex and the 2D series will give you foundations to follow along more comfortably.

We prepared some game assets so we can jump straight to the code. You can download them here: Squash the Creeps assets.

We will first work on a basic prototype for the player's movement. We will then add the monsters that we'll spawn randomly around the screen. After that, we'll implement the jump and squashing mechanic before refining the game with some nice animation. We'll wrap up with the score and the retry screen.