Top Down Survival Shooter In Godot | Part 2 - Player Movement

Поділитися
Вставка
  • Опубліковано 28 чер 2024
  • Learn how to make a game from scratch in Godot. This survival shooter will be a top down game with 8 directional movement. Endless waves of enemies attack the player with each wave getting more and more difficult.
    In this part, I focus on creating the player and adding 8 directional movement.
    Explanation of 8 directional movement by kidscancode here: kidscancode.org/godot_recipes...
    Code and assets for this video: github.com/russs123/Prairie_K...
    Credits for images
    Character: axulart.itch.io/small-8-direc...
    Goblins: 0x72.itch.io/dungeontileset-ii
    Tileset: cupnooble.itch.io/sprout-land...
    Pistol: arcadeisland.itch.io/guns-ass...
    Coffee: skalding.itch.io/coffee-cup-001

КОМЕНТАРІ • 17

  • @qmerk2661
    @qmerk2661 11 днів тому

    loving this series so far. you teach very well. when we got to the "var input_dir = Input.get_vector("left","right","up","down")" part, and you left out normalized i figured you were going to go back and add it later, so i added it beforehand. come to find out, you added it on another line. im pretty sure you already know that you can do this, but i added it on the same line like this
    var input_dir = Input.get_vector("left","right","up","down").normalized()
    this is just the way ive always done it when having the movement like this.
    either way is great tho. thanks again

  • @JameishLestray
    @JameishLestray 6 місяців тому +1

    Finally!!! Thanks Russ! Can't wait for part 3!! Please do make a platformer tutorial like Coco code did!! You two are the best at explaining and are my favorite teachers!!

  • @Lansamatv
    @Lansamatv 6 місяців тому

    You are truly the best, you don't know how much I love you. ❤

  • @kamsiosuachalla
    @kamsiosuachalla 6 місяців тому

    Love your videos, very informative

  • @kriftik1945
    @kriftik1945 6 місяців тому

    Keep it up!🤩

  • @Snyper-if3kt
    @Snyper-if3kt 2 місяці тому +1

    So with the input_dir variable it doesn't actually need to be normalized. Part of the Input.getvector function is that it does do that for you. I saw this as strange and so I checked the numbers (not just with the eye test). And the velocity was indeed normalized be itself.
    For added thought though I add the normalized function onto input_dir and low and behold, the result came back the same so its not hurting anything if its there, its just not needed.🙂

    • @CodingWithRuss
      @CodingWithRuss  2 місяці тому +1

      Ah that's handy to know! Thanks for checking it 🙂

  • @rezashir3873
    @rezashir3873 6 місяців тому

    very good😍

  • @JustAChannel11631
    @JustAChannel11631 6 місяців тому +1

    Love your channel. 2 questions if I may: 1) Why you picked Godot for it? 2) What do you think the best language/engine to make light 2d games?

    • @keznoAU
      @keznoAU Місяць тому

      godot is best for small and large 2d games unity good for 2d games and smaller 3d games unreal good for large 3d games

  • @ivanyosifov2629
    @ivanyosifov2629 5 місяців тому +2

    9:11 - I'm confused. We use position variable that we didn't declare previously. Same with velocity.

    • @CodingWithRuss
      @CodingWithRuss  5 місяців тому +1

      These variables are part of the CharacterBody2D Node already. When the script is created, the first line is "extends CharacterBody2D" and what this means is that the script can use all the functions and variables that are part of that Node. That includes the position and velocity variables. Hope that helps!

    • @ivanyosifov2629
      @ivanyosifov2629 5 місяців тому +1

      Yes, thank you. That explained enough to understand what's going on

  • @kamsiosuachalla
    @kamsiosuachalla 6 місяців тому +3

    I was the First to like🎉🎉🎉

  • @rolodagger4386
    @rolodagger4386 5 місяців тому

    Viewport rect size function doesn't work for me, it doesn't start my scene from point 0,0 so i can't get near the east and northern gaps. Any idea what's wrong?

  • @Lansamatv
    @Lansamatv 6 місяців тому

    Please make it survival io style, like this a rougelike

  • @arbozaliyan
    @arbozaliyan 4 місяці тому +2

    var mouse_position= get_local_mouse_position()
    var angle = rad_to_deg(atan2(mouse_position.x , mouse_position.y))
    if angle > -22.5 and angle < 22.5:
    $AnimatedSprite2D.play("walk_D")
    elif angle > 22.5 and angle < 67.5:
    $AnimatedSprite2D.play("walk_DR")
    elif angle > -67.5 and angle < -22.5:
    $AnimatedSprite2D.play("walk_DL")
    elif angle < -157.5 or angle > 157.5:
    $AnimatedSprite2D.play("walk_U")
    elif angle > 112.5 and angle < 157.5:
    $AnimatedSprite2D.play("walk_UR")
    elif angle > -157.5 and angle < -112.5:
    $AnimatedSprite2D.play("walk_UL")
    elif angle < 112.5 and angle > 67.5:
    $AnimatedSprite2D.play("walk_R")
    elif angle > -112.5 and angle < -67.5:
    $AnimatedSprite2D.play("walk_L")
    if velocity.length() == 0:
    $AnimatedSprite2D.stop()
    $AnimatedSprite2D.frame= 1
    This is what i did