Make Your First 2D Game with Godot: Player and Enemy (beginner tutorial part 1)


Learn to create your own games with Godot in this beginner tutorial series.
Part 2:
Get the extended edition:
Get our platformer character course (intermediate-level):

Get the start assets:
GDScript beginner tutorial:
Learn Godot with free resources:
Godot step-by-step getting started guide:

This project is sponsored by Gamblify:


00:00:00 Intro
00:00:25 Who this course is for
00:00:59 What you will learn
00:01:37 Get the extended edition

The Player

00:02:19 Getting the assets
00:02:48 Creating the Godot project
00:04:13 Creating the Player scene
00:11:46 Setting up the Player scripts
00:15:17 Coding character movement
00:15:56 Getting type hints with autocompletion
00:19:52 Adding gravity
00:23:44 Limiting the player’s speed
00:27:04 Adding a floor
00:31:52 Setting up physics layers
00:36:31 Coding the input
00:43:13 Calculating the player’s move direction
00:45:25 Moving the player horizontally
00:47:57 Calculating jump input
00:51:32 Coding the player’s jump
00:52:28 The scope of variables
00:54:00 Back to coding calculate_move_velocity
01:00:19 Preventing the velocity from resetting every frame
01:03:21 Interrupting the jump
01:05:32 Renaming variables to clean up our code

The Enemy

01:10:41 Creating the enemy scene
01:13:20 Coding the enemy
01:19:28 Optimizing the enemy with the VisbilityEnabler2D
01:26:06 Stomping the enemy
01:30:49 Making the enemy die when stomped
01:36:04 Adding the player’s stomp

Creating a test level

01:43:36 Coding the player’s death
01:45:19 Improving the camera
01:50:56 Creating our mini level
01:55:18 Adding a background

Discord ►
Twitter ►


Xem thêm bài viết khác:


  1. hey guys, may I ask what version is this guy using, cus I downloaded it but it was kinda different and I was immediately disorientated since the start of video.

  2. Can someone explain 47:00 I dont really understand how it works? Like what does that change from 0.0 to 1.0 change to make gravity

  3. Thanks for tutorial! Can You help with killing enemy. I wrote in class Enemy:

    func _on_Stop_Detector_body_entered(body):

    if body.position.y > get_node("StompDetector").global_position.y:


    get_node("CollisionShape2D").disabled = true


    But the player can;t kill the enemy. Only enemy kills the player. How to fix it?

  4. Why did you choose a custom node instead of 2D scene at the start?
    *Edit:* Now I understand, scenes are used like Unity prefabs too

  5. I would call this tutorial "Intermediate" rather than "Beginner". There are a lot of conventions and methods that would make sense to someone who has had programming experience, rather than someone who is completely new to Godot.
    (I'm specifically thinking of students who are moving from, say, Scratch to learn a more advanced programming environment.)

  6. I don't understand why we need to continue to change the velocity in the y-direction once the Enemy hits the ground, or if the enemy id properly placed, I don't know why we need to change the y value at all

  7. When I come to the stomping part, my player just doesn't do a stomp. It kills the enemy but the enemy just disappears and the player just goes through the enemy… I didn't change velocity to out bcs. I can't associate with the word out but I don't get why the player doesn't do stomp… My code is the same as on the video

  8. My player does stomp correctly, but changing the stomp_impulse value in the code or in the inspector doesn't change the height at which he bounces. Any ideas why adjusting this value isn't working? Or am I misunderstanding the stomp_impulse value?

  9. at 19: 15 you drag them as one piece, how do you do that, mine are separating and i guesse that thats the reason why i cant see my player move?

  10. Good tutorial! In my opinion, you should have spent less time on the "what you will learn" section and jumped into it faster, but the actual tutorial was good. Thanks for the vid!

  11. func _on_EnemyDetector_body_entered(body: Node) -> void:


    Everytime I put this into the script the player disappears when I play the game.

  12. I keep getting the error "The identifier _velocity isn't declared in the current scope." PLEASE HELP ME WHEN I RUN MY GAME IT'S BLANK.

  13. How do I make my enemy collide with my player? It dies from the stomp but even just colliding normally kills the enemy. It did't collide at all before I put in stomps. Help?

  14. Is it just me or does my player not collide with the enemy? Now that I have the stomp detector it dies when the enemy touches me but I don't want my player to kill it just by colliding? Help!

  15. 1:02:26 watch the else 1.0 part on the right side, as he scrolls down it turns into 0.0 magically rrrreeeee!!

  16. I'm at 1:19:17 . My player doesn't colide with the enemy.

    extends "res://src/Actors/"

    func _ready() -> void:

    _velocity.x = -speed.x

    func _physics_process(delta: float) -> void:

    _velocity.y += gravity * delta

    if is_on_wall():

    _velocity.x *= -1.0

    _velocity.y = move_and_slide(_velocity, FLOOR_NORMAL).y
    This is my code.

  17. 31:30 When I drag the character onto the grid, it just vanishes instead of being placed. I can't figure out anything I've done differently than you so far, although I am using 3.2.1, which I believe is a newer version than the version used in this video. I'm also on a mac.

  18. Hi. regarding to the camera limits: To set them manually for every scene seems a bit overload. Is it posible to do it programmatically? I mean, something like:
    In _ready function (or so) for the camera, look for the proper properties of the tileset and use them to set the properties of the camera



Please enter your comment!
Please enter your name here