How to Create SMOOTH Player Movement in Godot 4.0

Поділитися
Вставка
  • Опубліковано 16 бер 2023
  • In this Godot 4 tutorial I go over how to create smooth player movement step by step, and i believe having really good character movement is one of the most important things to have correct in your game. Good player movement can make your godot 4 game go from mediocre to crazy good.
    ----------------------------------------------------------------------------------------------------------------------------------------
    Thank you so much for watching I really hope this video helped.
    if you did enjoy then please go and click that subscribe button to help out the channel. I means so much and I love your feedback in the comments to let me know what it is that you enjoyed. Again thanks so much and I would love to see you again!
    have a great rest of you day and of course be safe :)
    - thanks DevWorm,
    ----------------------------------------------------------------------------------------------------------------------------------------

КОМЕНТАРІ • 228

  • @redawgts
    @redawgts Рік тому +122

    The code can be simplified with `Input.get_vector` and `velocity.move_toward`. You get the same effect with less lines of code.

    • @JAMRIOT
      @JAMRIOT Рік тому +12

      hey im totally new to this, what lines would i replace with these two?

    • @sheepcommander_
      @sheepcommander_ Рік тому +2

      Thanks a lot!

    • @sheepcommander_
      @sheepcommander_ Рік тому +24

      @@JAMRIOT
      velocity = Input.get_vector("left","right","up","down") * SPEED
      move_and_slide()

    • @lunarfoxgames
      @lunarfoxgames 10 місяців тому +2

      This is so cool, thanks!

    • @MootPotato
      @MootPotato 8 місяців тому +3

      @@sheepcommander_ I do apologize but I am still having trouble figuring out what to do to simplify this code. If someone could provide a little more detail I'd be so grateful!
      I am not finding the lines mentioned and no matter what I try to change it just bugs out.

  • @davekudrev4849
    @davekudrev4849 10 місяців тому +4

    Thank you so much! I been looking ages for a guide to set up a character body movement identical to rigid body. This is going to be a great foundation to play around with. You made my Monday evening a blissful one. :)

  • @williambrodzinski
    @williambrodzinski Рік тому +7

    Thank you so much I cant tell you as someone who has just got into coding how much this has helped with my players movement your way of explaining things is amazing and I left and sub and like and about to go watch more of your vids! Keep up the good work!!

    • @dev-worm
      @dev-worm  Рік тому +1

      thanks bro, looking to upload many more tutorials on all godot topics

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

    Really useful for creating slippery ice floor movement. I was setting new velocities instead of adding and substracting to it, which gave me a lot of issues on the slip behaviour when turning directions

  • @dajoma36
    @dajoma36 Рік тому +15

    Thank you for another great video. You have a knack for explaining things that is easy to follow and understand. I am looking forward to more of your videos on Godot 4.0. I really like that you explain what is different in Godot 4 from Godot 3 and I can't wait to see what you cover next. You be safe, and have a great day.

    • @dev-worm
      @dev-worm  Рік тому +2

      Glad it was helpful! Looking to make many more godot 4 tutorials, and if you need anything let me know!

  • @arukon3111
    @arukon3111 7 місяців тому

    Stumbled upon this when looking for something else, but damn, it helped me a lot.
    i was worried about scaleability with my previous approach on player movement but your code eliminated that fear and got me excited to build on it.
    Thanks a bunch for the great video!

    • @dev-worm
      @dev-worm  7 місяців тому +1

      so happy to hear that!

  • @root......
    @root...... 10 місяців тому +1

    Your tutorial really helps me in the journey of learning to use Godot!

  • @Tillionz
    @Tillionz Рік тому

    Thank you so much for this tutorial excellent descriptions and great code!!!

  • @marcosmachado6844
    @marcosmachado6844 7 місяців тому +22

    For people around still
    Simplified code with just 7 lines of code:
    func player_movement(input, delta):
    if input: velocity = velocity.move_toward(input * SPEED , delta * ACCELERATION)
    else: velocity = velocity.move_toward(Vector2(0,0), delta * FRICTION)
    func _physics_process(delta):
    var input = Input.get_vector("ui_left","ui_right","ui_up","ui_down")
    player_movement(input, delta)
    move_and_slide()

    • @jiboodie5344
      @jiboodie5344 6 місяців тому +4

      it says speed not declared

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

      @@jiboodie5344 add the following lines after extends CharacterBody2D:
      @export var SPEED = 100
      @export var ACCELERATION = 200
      the @export keyword allows you to change these values on the editor itself

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

      Add a speed variable to your character ​@@jiboodie5344

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

      Correct me if I'm wrong but if you're running your movement functions inside _physics_process shouldn't you go ahead and get rid of delta in move_towards?

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

      Its because you are running it inside the physics process that you do want to have the delta there. Physics process is called every frame and delta is the time passed between the last frame and the current frame. If your computer is running at let's say 60 FPS, your delta value would be usually something like 0.01667, but if it was running at 120 it would be something like 0.083334.
      If you dont actually put delta there, the player would be moving at the top speed, every frame, and instead of having that smooth movement the player would move extremely faster than it should.
      Putting delta there guarantees that the player will have that smooth movement and that it will work as intended, no matter the FPS your machine is running at.

  • @cuppixd4267
    @cuppixd4267 Рік тому +2

    Was hoping for vids with godot 4, love it thx

    • @dev-worm
      @dev-worm  Рік тому

      many more godot 4 tutorials coming really soon!

  • @MateHall
    @MateHall 10 місяців тому +1

    your so good at explaining this stuff thanks !

  • @enterthearcade
    @enterthearcade 8 місяців тому

    I was able to use this and tweak it just a little bit, but man, this is really super smooth movement. Thanks for this!

    • @dev-worm
      @dev-worm  8 місяців тому

      So glad to hear that!!

  • @TheEx404
    @TheEx404 Рік тому +4

    Thanks, great tutorial. ❤

    • @dev-worm
      @dev-worm  Рік тому +1

      Glad it was helpful!

  • @Tmaster2006YT
    @Tmaster2006YT 23 дні тому +1

    Thank you. This is the first coding tutorial I’ve followed that gave me a tangible result.

    • @dev-worm
      @dev-worm  23 дні тому +1

      so glad it was able out!

  • @lordbmc3656
    @lordbmc3656 7 місяців тому +2

    i did every thing he did and i cant make the player move and i dont have any errors popping up what could i have done wrong

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

    For anyone who wants to use animations with their sprite and is struggling, I added a few lines of code based off of dev worm's other video to help:
    Declare at top:
    var current_direction = Vector2.ZERO
    var current_animation = ""
    Add to existing code:
    func _physics_process(delta):
    player_movement(delta)
    play_direction_anim(delta)
    func play_direction_anim(delta):
    var anim = $AnimatedSprite2D
    var new_animation = ""
    if input.x != 0 or input.y != 0:
    current_direction = input
    if current_direction.x > 0 and velocity.length() > 0:
    new_animation = "walk_right"
    elif current_direction.x < 0 and velocity.length() > 0:
    new_animation = "walk_left"
    elif current_direction.y > 0 and velocity.length() > 0:
    new_animation = "walk_down"
    elif current_direction.y < 0 and velocity.length() > 0:
    new_animation = "walk_up"
    else:
    if current_animation.ends_with("_right") and velocity.length() == 0:
    new_animation = "idle_right"
    elif current_animation.ends_with("_left") and velocity.length() == 0:
    new_animation = "idle_left"
    elif current_animation.ends_with("_down") and velocity.length() == 0:
    new_animation = "idle_down"
    elif current_animation.ends_with("_up") and velocity.length() == 0:
    new_animation = "idle_up"
    if new_animation != current_animation:
    anim.play(new_animation)
    current_animation = new_animation

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

    I appreciate you taking the time to explain what your code means.

    • @dev-worm
      @dev-worm  2 місяці тому +1

      happy to hear!! hope it helped! thank you!

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

    Thank you soo much for the tutorial... Super easy to follow! I was following your other tutorial as well "how to create an rpg in godot" and I'm not sure on how to add the animations to this movement? If you could help I'd really appreciate it!

  • @Now_Roxas
    @Now_Roxas 9 місяців тому

    Thanks this is really helpful.

  • @sockretett
    @sockretett 7 місяців тому

    Thanks for tutorial!

  • @lphipps1986
    @lphipps1986 10 місяців тому +1

    my debugger goes off the charts when i try to move. i coded everything as you did and it all checked out. but when i try to play the character doesnt move

  • @pancake_776
    @pancake_776 8 місяців тому

    Super nice tutorial! Thanks!

    • @dev-worm
      @dev-worm  8 місяців тому

      of course anytime!

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

    When I tried it. I could only move a certain amount before permanently decelerating. I would have to hit the arrow keys again to keep moving (and go even faster). It's cool, but it doesn't look like what you did in the video (or at least I don't think it does).

  • @maciold8781
    @maciold8781 16 днів тому

    Thank you, it's a great tutorial!

    • @dev-worm
      @dev-worm  15 днів тому

      so happy to hear that!! thank you!!

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

    thanks for the tutorial, I learnt a lot but when I try to run the program I get the error:
    invalid operands 'Callable' and 'Vector2'
    I've double checked the code and don't think anything is wrong but it won't work, this error has been brought up in a previous comment as well, could someone please help?

  • @D-Samurai
    @D-Samurai 4 місяці тому

    very easy to understand thank you!!

    • @dev-worm
      @dev-worm  4 місяці тому

      so glad to hear!! thank you! happy it helped!

  • @BusterDM
    @BusterDM 4 місяці тому

    this was very well explained and easy to understand for a beginner

    • @dev-worm
      @dev-worm  4 місяці тому

      so happy to hear! thanks!

  • @IronModeOfficial
    @IronModeOfficial Рік тому +1

    Yes man glad your back. Let’s get this goin
    Btw my game is almost done just need to work my inventory

    • @dev-worm
      @dev-worm  Рік тому +2

      inventory is pretty complex but im working on a video right now for the inventory system and it should be very helpful for you.

    • @IronModeOfficial
      @IronModeOfficial Рік тому +1

      @@dev-worm I Appreciate it

  • @Kxloedit
    @Kxloedit 11 місяців тому +1

    Cant describe the smile on my face after it worket thanks

    • @dev-worm
      @dev-worm  11 місяців тому +1

      so glad i could help :)

  • @alexsanderrain2980
    @alexsanderrain2980 Рік тому

    This is pretty neat

  • @voilano6816
    @voilano6816 10 місяців тому

    This whole code is without delta time, I know that move_and_slide function adds delta but only to the parameters inside right? So what are the places to put the delta if anyone konws?

  • @Miiite
    @Miiite Рік тому +3

    Your video si already very clear, but what might make it clearer is adding a few comments along the way.
    Basically when you define the if clause to handle the acceleration and the deceleration, adding a simple comment above the if and else to say "# handle acceleration" and "# handle deceleration" would help clarify things.
    But that's just a bonus, the video is pretty clear as it is already, thanks !

  • @peshkatfathi6661
    @peshkatfathi6661 Рік тому

    Thanks🤘

  • @Yinithyn
    @Yinithyn 8 місяців тому

    You have this video on smoother movement, and it works! but you also have a video on animation in the other RPG series, how do i combine the two?
    i want this guys movement and the characters animation.

  • @Lukydnomo
    @Lukydnomo Рік тому +3

    hey bro, how would you put in code a way to change sprites or animations etc? like, for example, putting a walking animation when the character walks and such, I wrote the code and I didn't find a way to implement this "mechanic" of changing sprites and such, if you can answer me I'd appreciate it, thanks, great video

    • @Gameaholick
      @Gameaholick Рік тому +5

      you want to declare the animations as a variable you can call so for me " @onready var _animated_sprite = $AnimatedSprite2D " then in your if function you call it to be played here is an example " if Input.is_action_pressed("right"): " and to idle you assign the idle like this " elif Input.is_action_just_released("right"):" you then repeat this for all your directions
      _animated_sprite.play("walkRight") _animated_sprite.play("idleRight")

  • @Rotado
    @Rotado 9 днів тому

    Thank you so much :D

    • @dev-worm
      @dev-worm  9 днів тому +1

      thank you!! glad it helped!!

  • @driescoppens834
    @driescoppens834 Рік тому

    do you have any idea how to make sure the player can't leave the erea

  • @sethypoo5728
    @sethypoo5728 2 місяці тому

    it keeps telling me it cant find limit_length on base Vector2?

  • @JustTaaco
    @JustTaaco Рік тому +2

    I'm looking very much towards tutorials on shaders for godot 4, and just more godot 4.0 tutorials in general :))

    • @dev-worm
      @dev-worm  Рік тому +1

      Going to be uploading like every other day for godot 4 tutorials

  • @websdevgio
    @websdevgio 4 місяці тому

    i love your video it my first time in godot and was awesome

    • @dev-worm
      @dev-worm  4 місяці тому

      thank you so much! happy to hear that!! if you ever need anything else then please let me know!! I am more than happy to help!

  • @Agent_008
    @Agent_008 3 місяці тому

    Thank you so much!!!!!

    • @dev-worm
      @dev-worm  3 місяці тому

      of course! anytime! thank you!

  • @Valori_4
    @Valori_4 9 місяців тому +1

    how to use a variable twice in one script ? plz telll me i need to know

  • @OfficialGoldenLeaf
    @OfficialGoldenLeaf 7 місяців тому

    How would i go about movement without diagonals?

  • @t_t_tomas
    @t_t_tomas Рік тому +1

    the "velocity" variable at 11:00 is not declared anywhere, what am I missing?

    • @t_t_tomas
      @t_t_tomas Рік тому +1

      I found the error, I updated to 4.0 and its fixed

  • @bloodc0re_
    @bloodc0re_ 9 місяців тому

    Thank you very much

    • @dev-worm
      @dev-worm  8 місяців тому

      of course anytime.

  • @Intergalacticprismaticcreature
    @Intergalacticprismaticcreature 4 місяці тому +1

    im porting my scratch game to godot and this is gonna help so much!

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

    is there a resource that goes over all of the built in functions? No matter how good you get at coding you cant be a mind reader and know whats in all of these functions to use them. And wtf is delta?

  • @guilhermepimenta8119
    @guilhermepimenta8119 28 днів тому

    I have a very niche problem and I can't figure it out alone
    In the game that im making my character can spin and move with key presses
    I got to a point where I have this video's movement and the rotation working (pressing f to rotate to the left and g to rotate to the right) but if iI hold both rotating buttons at the same time i can only move up for some reason .
    Can somebody help me with this?

  • @Mr.Kef_art
    @Mr.Kef_art 7 місяців тому

    I'm getting an error when I press play. It says: "Invalid Call. Non existent function "is_action_pressed" in base "Vector2". Tried to fix it but I don't know what to do.

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

      I had the same thing happen, I just had to capitalize the i in Intput.is_action_pressed

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

    sorry for commenting a whole year later, but i have a problem that needs to be fixed, i can't collide with anything, i tried using the move_and collide script, but it didn't work, how would i make it work?

    • @dev-worm
      @dev-worm  Місяць тому

      do you have a collisionshape2d within the scene? you will still beable to collide with the environment even with move and slide as long as all the objects including the player have a enabled collisionshape2d!! hope this can help! if not let me know!

  • @exorim9044
    @exorim9044 8 місяців тому

    How do you make udlr movement in godot like in pixel rpg games

  • @DRND12
    @DRND12 Рік тому

    Thanks

  • @user-os4gw9eq6c
    @user-os4gw9eq6c 5 місяців тому

    BEST BRO

  • @TrueSaLegend
    @TrueSaLegend 27 днів тому

    hey I have a problem my charakter is not moving up or down. When I press the up or down arrow I move for 1 or 2 pixels.

    • @dev-worm
      @dev-worm  27 днів тому

      make sure you don’t have if input.is_action_just_pressed. because if you have the “just” pressed it only calls it once instead of calling it the entire time the button is pressed down

  • @0CutieCat0
    @0CutieCat0 Рік тому +2

    Tutorial about Minimap with objective locations and such 👉👈

  • @BenTyler-eq2xx
    @BenTyler-eq2xx 27 днів тому

    EVERYTIME i start a game (super noob, still a hobby), i try to reinvent the wheel with controls. THIS is how to do it.. the other ways can feel different/fun, BUT the bugs it presents are endless down the line. Stick with this, make it feel how you want by modifying it, but if you are day one new..... just do this, it IS correct. Thats why for the 5th time ive tried to vary movement, i have found my way back to tutorials to debug. if i can offer any advice to other new people, just do this!

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

    I'm pretty sure I'm using the same code but i keep getting "Invalid call. nonexistent function 'is_action_pressed' in base 'Vector 2'" any suggestions?

    • @dev-worm
      @dev-worm  10 днів тому

      what input is within the is_action_pressed()... did you make sure to create that as a input in the input map within the project settings?

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

    I get the error "invalid call. nonexistent function 'is_action_pressed' in base 'Vector2'."

  • @ignaciodangelo6385
    @ignaciodangelo6385 Рік тому

    Great video , i have a question , velocity = velocity.limit_length(max_speed) here velocity is a Vector2d but max_speed is an integer . Why does this works and what is Godot interpreting ?

    • @jorijndg
      @jorijndg Рік тому +1

      It's not limiting X and Y separately, but limiting the length of the vector.
      It's the equivalent of normalizing the vector (dividing by its length), then multiplying by the limit value, effectively setting the length to the limit value.
      It only does this when the length is greater than the limit value, otherwise the vector doesn't change.

  • @agusnutt
    @agusnutt 4 місяці тому

    Can somebody help me
    I need to put an animation of walking diagonally to my character, but I don't know how to put the code
    I want the animation to occur when pressing 2 keys

    • @dev-worm
      @dev-worm  4 місяці тому +2

      I went over this in the first episode of the survival series!! and I think it is exactly what you are looking for!! I hope it helps! ua-cam.com/video/eAEe_9jCV4s/v-deo.html

  • @manusgraham1159
    @manusgraham1159 Рік тому +2

    I tried using this code but for 3d and it works for the most part, but it seem as soon as you stop pressing an input the physics stop working, life you hold left and then let go it stops dead, but once you press a different input like down for example then it steers into it like you were holding left the entire time, it's like the game is paused when you stop pressing inputs, anyone know why that is, any help is appreciated thank you

    • @dev-worm
      @dev-worm  Рік тому +2

      Ooo im sorry i have no idea, have never played with 3d but if you check godots discord im sure someone would love to help

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

      For me I ran into the same issue, but I was able to fix it by setting "friction" to a very small number. Granted, I had to set my max speed to a super small number as well (0.05), but setting my friction to around this number solved the issue for me

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

      Happened to me too and I'm in 2d

  • @DyIanGaming
    @DyIanGaming 6 місяців тому +2

    Is it easy to animate the player with an animated sprite 2d and this type of movement?

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

    So how do I add animations in this code?

  • @kuboking2123
    @kuboking2123 9 місяців тому

    I cant get it to work :( can anybody help the charcter dosent show up whenever i press the play button. EDIT: i made the player move but it dosent wanna move no matter what i do

  • @graso-ln8nb
    @graso-ln8nb 5 днів тому

    I doubt u'll see this, but just in case, ive been looking for a way to make the player sprite smooth, not the movement, but where's the sprite looking at, i cant find anything so this is like a last resort, thank u in advance (sorry for bad english)

  • @buttialmahairbi2854
    @buttialmahairbi2854 Рік тому

    hey devworm can you make a video on a platformer movement please man ❤

  • @daemonphil3132
    @daemonphil3132 Місяць тому +1

    Hi, i tried to do it and my Godot is saying : Invalid call. Nonexistent function 'is_action_pressed' in base 'Vector2'... and i don't understand what to do now...

    • @TFAmbience
      @TFAmbience Місяць тому +1

      You need to make sure you have the text exactly as shown on screen. If anything is capitalized or lower cased in the wrong spot, the function won't work

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

      @@TFAmbience

  • @duck761
    @duck761 Рік тому

    can you explain me how pressing a button changes the input and why does this
    "input = Input.get_vector("move_left", "move_right", "move_up", "move_down")" fuocking work

    • @Amazing_Software
      @Amazing_Software 9 місяців тому

      The "move_left" etc. are part of Godot's built in input mapping. If you open Project Settings, then Input Map, then check "Show Built-in Actions" and you can see a bunch more too. These are such standard events, that Godot bakes them in. You can define your own stuff too, or remove the built ins.

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

    did i miss something? when did you define velocity? I don't see it here. how come this isn't throwing an error?

    • @dev-worm
      @dev-worm  Місяць тому

      you no longer have to define velocity on a characterbody2d in godot 4 like you did have to do in godot 3!!

  • @ivaneban2121
    @ivaneban2121 3 місяці тому

    Can some one help me pls... i did everything as in the video but i can movie neither with WASD , mouse, with the arrows

    • @dev-worm
      @dev-worm  3 місяці тому

      did you use "ui_up", "ui_down", etc? If so that should be the arrows and if you want WASD then you have to go into the Project settings > input map - and create new input actions. for example "right" and assign that to the "d" key. Then in the code use "if is_action_pressed("right"):"

  • @dwried
    @dwried 2 місяці тому

    I'm actually glad this script is broken down this way. Working on something like a top down flight game. It gave me insight on how I want to go about it now. I have to take into account airspeed and drift. Many thanks. My movement script was going to be an utter mess. Lol.

    • @dev-worm
      @dev-worm  2 місяці тому

      so happy it was able to help!! goodluck on your game!! keep me updated on it.. Im curious now!

  • @Hatsenc
    @Hatsenc 8 місяців тому

    Mine just crashes when I try to run the scene

  • @randomsounds2167
    @randomsounds2167 Рік тому +2

    Smooth

  • @gman8398
    @gman8398 Рік тому

    is there a way to not normalize the movement?

  • @marang_quntana7350
    @marang_quntana7350 Рік тому

    Yess Godot 4.0 Les gooo

  • @IGNAMYTE
    @IGNAMYTE Рік тому +1

    you are going to make more tutorials on godot 4.0 and above?

    • @dev-worm
      @dev-worm  Рік тому

      yes working on a ton right now. going to upload one every other day starting the 12th

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

    i am watching at 1080p and using upscale and i still cant see text clearly. is that I or i small? not clear.

    • @dev-worm
      @dev-worm  5 місяців тому +1

      really?? I'm looking back and it is visible clearly to me... is it still like that for you?

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

      Yep. it is not real 1080p video. like the res is 1080 but i am sure the bitrate is not that of an actual 1080p video. I have seen 720p videos clearler than this. but it is fine. Thanks so much for your tutoiral. :)@@dev-worm

  • @pakancina3138
    @pakancina3138 Рік тому +1

    what programing languige was used here?

  • @agam3z153
    @agam3z153 2 місяці тому

    how can i animat this ??

  • @successspotu
    @successspotu Рік тому

    Godot 3.5 if i create button i can also use and access by mobile game or app touch input but godot 4 i create button and export to android i can't use or access that button why any fix available please tell me

    • @dev-worm
      @dev-worm  Рік тому

      I’m not sure I’ll look into it because many thing have been changed

    • @successspotu
      @successspotu Рік тому

      @@dev-worm yes

    • @successspotu
      @successspotu Рік тому

      @@dev-worm you wil find please make a video

  • @Gamer-br1fk
    @Gamer-br1fk Рік тому

    How can I add the animationsprite in this case??

    • @dev-worm
      @dev-worm  Рік тому

      the animationsprite should be added the same way it was in godot 3, so instead of adding the normal sprite2d add an animatedsprite2d and just create the animations then call for the animations in the code based on the input variable

  • @Lansamatv
    @Lansamatv 10 місяців тому +1

    you can make tutorials for a donw top shooter game

  • @icecoldmagic
    @icecoldmagic 7 днів тому

    is saying that my velocity is undefined and wont let me add a velocity function, variable or constant

    • @dev-worm
      @dev-worm  7 днів тому

      are you in godot 4?? because that seems like an error you’d get in godot 3 before the velocity was a thing. Hoping that helps you a bit

    • @icecoldmagic
      @icecoldmagic 7 днів тому

      @dev-worm no I'm in 4 100%

  • @sanitarysanchez
    @sanitarysanchez 9 місяців тому +1

    i'm getting an error message (Invalid operands 'callable' and 'Vector2' in operator '==')

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

      same here, i'm not sure what to do about it, did you manage to fix it in the end?

    • @gatocalcio
      @gatocalcio 4 місяці тому

      @@pytho2909 pls share code for check

  • @Kumo0
    @Kumo0 Рік тому

    Can u pls make a vid about how to make a smooth jump in Godot 4

  • @ImaLineOfCode
    @ImaLineOfCode Рік тому

    how do i move?

  • @SilverLightDungeon
    @SilverLightDungeon Рік тому +2

    Look, I have this little amount of projects (maybe 3948), and I am always very anxious about the final product, and I forget that despite knowing programming, I have no idea what I am doing in a gaming creation engine. So I just threw away my pride (in a tin of pink trash) and I'm learning from zero all the basic mechanics of how to create a character. Thank you so much for helping me to create my perfect game, if I even complete a demo of the game I bring the link to those interested in knowing the project.

    • @dev-worm
      @dev-worm  Рік тому +1

      hey, glad i could help. I am really interested in knowing about the project btw

  • @ifrough4777
    @ifrough4777 Рік тому

    invalid operator: nil & int in operator "*". line 5 nani

  • @floking2480
    @floking2480 Рік тому

    I followed the tutorial and all but I can't seem to get the character moving like nothing crashes or any error's just the player movement itself doesnt work. Anyone can help?

    • @dev-worm
      @dev-worm  Рік тому

      did you make sure to add the move_and_slide func? cause if not player wont move at all

    • @mrfacebeard5005
      @mrfacebeard5005 Рік тому

      @@dev-worm I have the same issue and it still doesn't work even with the move_and_slide func

  • @softicyy
    @softicyy Рік тому

    I need to spam it before i move and i move really slowly

    • @dev-worm
      @dev-worm  Рік тому +1

      its because you might be useing if Input.is_action_just_pressed(xxxxx) instead of the one im using inside of this tutorial

  • @natsudragneel-808
    @natsudragneel-808 6 місяців тому +2

    It irritates the absolute frick out of me when I perfectly attempt to recreate what a turorial show. No wrong code at all. Line for line, word for word, letter for letter. Absolutely perfect. And it just doesn't work for whatever reason godot decided to just not work.

  • @Themrbobgaming
    @Themrbobgaming 3 місяці тому +1

    Hey can you do a video how to do the wasd button pls bc i think thats better combos and i dont under stand how to do it thanks for an answear or a video

    • @dev-worm
      @dev-worm  3 місяці тому +2

      Go to Project Setting > Input Map Tab > Type in "right" in the "Add New Action" Section. Then next to the "right" action click the + and then whatever key you want to be associated to "right" so "d"... then in code instead of saying "ui_right" just put the name of your action so for this instance put "right"...... hope that helps!!

    • @Themrbobgaming
      @Themrbobgaming 3 місяці тому

      @@dev-worm thanks it works thank you

  • @dylanwillyams
    @dylanwillyams 8 місяців тому

    im having trouble getting this and animations to work at the same time. any tips?

    • @dev-worm
      @dev-worm  8 місяців тому +1

      check out a series on the channel like the "How to Create a Survival Series in Godot 4" or the "How to Make an RPG in Godot 4" Series.. in both of those I go over this pretty good!

    • @dylanwillyams
      @dylanwillyams 8 місяців тому +2

      @@dev-worm yeah i was trying to follow along on the rpg series. but you cant add the dir = "right" and so on in the same line as the input.x= . Basically i cant figure out how to map out the direction mapping to correspond to activating animations.

    • @bigdaddystrokes
      @bigdaddystrokes 8 місяців тому

      @@dylanwillyams Interesting. I'm currently wondering how I can get my character in the RPG tutorial to move a little more freely in all directions as right now its stuck on the "up,left,down,right" directions only and it feels pretty stiff. I'm currently following the smooth movement tutorial, but its hard to wrap my head around how I will update the "RPG" tutorial movement lol!

  • @sebas9920
    @sebas9920 Рік тому

    😎👍

  • @keznoAU
    @keznoAU 2 місяці тому

    ok godot just hates me i do everything correct doesnt work i copy and paste code of the internet doesnt work i look at more tutorials doesnt work like it isnt that hard to make top down movement but just why wont it work for me

  • @idontknowwhattonamethischa4592
    @idontknowwhattonamethischa4592 8 місяців тому +1

    copy of code?

  • @theozmox
    @theozmox 10 місяців тому +2

    I get an error that says: "Identifier "delta" not declared in the current scope". Is there any solution for this?

    • @theozmox
      @theozmox 10 місяців тому

      I fixed it. Sorry :)

    • @theozmox
      @theozmox 10 місяців тому

      My mistake was "func player_movement():". I should've typed "func player_movement(delta):"

    • @dennnis_2675
      @dennnis_2675 8 місяців тому +1

      Thanks for the comment, I made the same mistake and wouldn’t have noticed it myself

  • @Col468
    @Col468 3 місяці тому

    hold alt to resize both sides a once

    • @dev-worm
      @dev-worm  3 місяці тому

      thanks, good tip!

  • @animationbros2304
    @animationbros2304 22 дні тому

    What kind of programming language is this?

    • @dev-worm
      @dev-worm  22 дні тому

      this is gdscript! it is a language created to work specifically for the Godot engine

  • @notacodingchannel9201
    @notacodingchannel9201 Рік тому

    Hey, I spotted a little bug here! When I try pressing both left and right keys simultaneously, it seems like I can't move upwards. Any idea why this is happening? Great video, by the way! Keep up the good work!

    • @MootPotato
      @MootPotato 8 місяців тому

      This is usually caused by a hardware limitation, where some keyboards can only send up to 2 or 3 keypresses at a time and if any other key (in my experience this used to be a common 'feature' that only occurred with the arrow keys especially on older keyboards) but can also be driver related, though it is unlikely.