i am a refugee from Unity. Thank you dev-worm for this tutorial! I really appreciate your in-depth explanations of what things do and how they operate.
Just saying "Hi" to all the other new Godot users who have jumped ship in the past couple of days. I only just started learning game development about 4 weeks ago on Unity, I'm thinking now is a good time to focus on a different tool.
As someone who is new to coding in general and godot, this tutorial is beyond amazing! It would be great if your future videos you made mechanics which we could simply add and expand on. Will continue to watch this series and the rest of your videos because i feel there isn't as much resources for godot 4 in terms of learning and this video alone is very inspiring! Thanks!❤
Good tip for people who don't want to flip the sprite to make it go left and right (so for example you have a dedicated sprite for left and right): You can just remove the lines that say anim.flip_h = true/false on the last if statements in the player script and then type in your own animation where it otherwise would be "side_walk" and "side_idle" respectively. It worked great. Awesome tutorial.
first off, im loving the tutorial so far. im already on ep. 4 but i figured id ask this here. i am pretty new to game dev and godot. so im pretty sure this is not the best way to go about this but id rather have my character have diagonal movement as well so i changed the code under the func player_movement(delta) part to func player_movement(delta): if Input.get_action_strength("Move_right"): play_anim(1) current_dir = "right" elif Input.get_action_strength("Move_Left"): play_anim(1) current_dir = "left" elif Input.get_action_strength("Move_Down"): play_anim(1) current_dir = "down" elif Input.get_action_strength("Move_Up"): play_anim(1) current_dir = "up" else: play_anim(0) var input_vector = Vector2.ZERO input_vector.x = Input.get_action_strength("Move_right") - Input.get_action_strength("Move_Left") input_vector.y = Input.get_action_strength("Move_Down") - Input.get_action_strength("Move_Up") input_vector = input_vector.normalized()
move_and_slide() now heres the thing. this took me forever to try to figure out (because im new to this stuff) but everything works as i wanted it to, and im happy about it, and honestly proud of myself for getting it to work at all lol. but im just gonna ask anyone that may know more then i do, if i did something wrong here that may bite me in the butt later on. im not asking for some nit picky answer just so you can try to flex your knowledge with an advanced answer, im only asking if, for me(a beginner thats just gonna use this tutorial to have a project to practice learning with(kinda like a starting template)) if this is a BASIC way to do this, and if its fine or not. thank you in advance
Beginner here myself, always look at the comments of the Video. Somewhere below user @sashabellor4344 posted a script below, but it was missing a line in the func _physics section, will copy below the correct code that worked for me after I fixed it up. @export var speed = 100 func _physics_process(_delta): var direction = Input.get_vector("left", "right", "up", "down") velocity = direction * speed move_and_slide() Voila, simple as that.. Just make sure to go into your Project > Project Settings > Input Map > Bind your keys "left" "right" "up" "down" to each separate Arrow/WASD, or the script will launch like 1000 errors a second looking for un-mapped buttons. Good luck sir, I was getting frustrated because the code in the video wasn't working properly either, and the previous comment from Sasha was slightly off, as when I tried func _physics_process(delta) It would debug an error saying it required a _delta .. hence, func _physics_process(_delta): and for some reason this no longer spits out any debug issues + works in all 8 directions.... 4 hours later RIP Saturday Night. Edit: After hours of frustration, this was all scrapped and followed the original tutorial, getting the animations to work was such a pain, I am sticking to what is shown to us.
legendary yt channel, been starting gamedev and your tutorials are so good as they explain everything we want to know and implement in our games. keep going!
So much better and faster than the outdated one I spent all day trying to debug, THANK YOU SO DAMN MUCH. I do need to learn how to type faster though, you type so quick I have to keep pausing and rewinding to pause it haha!
Learning from watching is tough and slow. A few good tips: Watch the video first. Then follow along after. Observe, take in what you can, and then go along with it. You're here to learn, but you can get stuck in a mental trap by following instructions, and not having time to understand. Also, put it to like 0x75 speed with the gear icon in RUclips. Good stuff to learn here, but also, the instructor moves way too fast, while you are trying to follow. No fault on them or you, this is a great series of tutorials, and there is a lot to be learned here.
Just started your series, just finished this video. Just wanted to say thank you for making this tutorial video series even though 2 years old almost this video alone has been very informative, helpful and honestly pretty cool watching few lines of code making something start to come to life.
Aww I am so glad to hear that it is still providing value. I really hope that the series helps you greatly and if you ever have any questions feel free to let me know! And that first time feeling of getting something to start moving on screen from your own work is a feeling you can never top... it is such a great feeling for sure. Goodjob and Goodluck throughout the rest of the series!
Thank you from Argentina, this video is of great help to me as I start a project I have in mind. It's undoubtedly a huge advantage to have this! Greetings.
dude, i like how much you covered in this one video. I also had my doubts tbh with how the animation was coded in, but it worked perfectly on my end like it did on your end! Whenever that happens, you know it's an amazing tutorial. I can't wait to watch your other tutorial videos for this series!
to move the player you could use this instead of the huge amount of if statements:- const SPEED = 100 var direction : Vector2 = Vector2.ZERO func _physics_process(delta): direction = Input.get_vector("left", "right", "up", "down") if direction: velocity = direction * SPEED else: velocity = Vector2.ZERO move_and_slide() it works the same.
@@doublecc6234 I used Animationtree, I learned the way from this video it is very helpful, ruclips.net/video/WrMORzl3g1U/видео.htmlfeature=shared Animationtree make things more simpler and easy.
The issue with this code is it adds diagonal movement if the player hits left and right at the same time. Diagonal movement in itself is not a bad thing but you will need new animations and more code to get it working. His code keeps that out and it fits top down feel better. Not saying there's not a better way.
Thank you so much, I just finished series yesterday and tried to do this part alone and almost did it but I am happy that I found different solution to animations and it works
Really good. Well explained. Really new to Godot but used other engines, your explanation of the way the variables and functions interact in the GD script really helped and was well timed. Thanks man
At 19:30, Instead of the ready function with the animation, inside of the animated sprite 2d you can set an animation to be the default when it starts, saves some coding
but with the ready function you can have multiple different start animations for different scenes, i.e. if you want the character to start facing the right in a boss fight.
I followed your directions to the letter until 12:28 but I don't see my character on screen at all in the debug edit: for some reason the scene was on world and not player but still cannot move my character in debug
If you still haven't fixed your non-moving character it may be because your input system for "ui_right" etc. only using the arrow keys, you need to put in the WASD movement yourself by going to Project --> Project Settings --> Input System (in the tab bar) --> Then putting them in for each of the ui_right ui_left. If that didn't fix it, you may not have move_and_slide() or not calling the method he made in process, or you may not have made the script differently from him and that made it not attached to the player
I usually favor reading over videos for learning new things, but the main benefit of video in learning game development is that you can match results much better. The problem arises when stuff doesn't work, and you have to keep scrolling for that tiny step you missed or did in another way. I created the script using the asset tree, by right-clicking the scripts folder and adding the script. This doesn't attach the script to the CharacterBody2D node. After about half an hour of scrolling through the video, I finally noticed in the inspector that no script was attached, so I simply attached it there and it worked. Turns out I missed the click on the attach script button in the video. Thanks for the series, it's going to be a fun one.
This was infact informative! I used to mess around in unity as a hobby years ago when I was a kid. Kinda dropped it because I just never knew what I really wanted to do with it, plus at that time I was used to writting in Java script, which did not translate well with the tutorials at the time. They were mostly wrote in C#, and trying to translate it to Java script when you barely knew code at all was rather difficult, lol. So I've been really wanting to get back into making some games for fun, and Godot seemed like a pretty good opportunity to do so, but I just couldn't figure out a good place to start. This video has atleast given me 1/2 a mind of what I'm trying to do, and how to do certain tasks, I will will follow the rest of this series with joy, and pleasure. Thank you good sir!
thank you!! i believe Godot is the best place of anyone to get started with development! and Im wishing you only the best!! if you ever need anything then please let me know! ill be glad to help!
I have watched a lot of videos about Godot and yours are the best . Your video literally explained everything and I was able to succeed in what I was trying to do
Pro tip: If you split it up into smaller functions such as move with move("left") and play_move with play_move("left", "side") and so on you can vastly simplify the code, more readable, composable and much less duplication. if/else and nesting statements is the bane of software dev.
So hard to find good quality tutorials for Godot 4,glad I found this one. Although for some reason if I use "delta" in the player movement function,no movement works whereas if I remove it,it works. Edit: for some reason,Godot didn't attach the script the player node. Idk how that happened,lol. all fixed now
Isn't thte whole process of picking the right animation in the code a bit convoluted? Do you really need that current_dir variable and that play_anim(1) in every if statement? I mean you could just pass the velocity vector into the function (play_anim(velocity) ), get its direction inside that func and pick the right animation with that, right? Also concatenating the Input check with all that elif statements creates some sort of hierarchy for the inputs, with "right" having the highest and "up" the lowest. I think you can do something like velocity.x = Input.is_action_pressed("right") - Input.is_action_pressed("left") velocity.y = Input.is_action_pressed("down") - Input.is_action_pressed("up") this has less hierarchy but pressing left and right at the same time cancels each other out and it allows diagonal movement.
Edit: it works!! Just had to multiply the integer difference by the speed value, like this: velocity.x = speed*(int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left"))) velocity.y = speed*(int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up"))) When I copied and pasted this right after func player_movement(delta):, it says "Invalid operands "bool" and "bool" for "-" operator" and I don't know how to fix this. Is the problem about the types of values being subtracted? What should I change for this to work? Does setting the input "bool" to an "int" fix this (I thought about this when remembering a beginner Python tutorial even though it's GDScript because I assumed there's at least a similarity here) or is my lack of coding experience showing?
Thank you very much!!! you have no idea how much this video helped me out, i've tried lots of videos and i mean a LOT and still didnt get as far as i got using this video. Keep up the good work man👌
At 12:25 my character doesn't appear on the screen and move around. I'm using my own sprite and it's bigger than your character sprite if that has anything to do with it. I copied down the code exactly so I don't know what to do
Do not worry about that just yet. What I heard from programmers, is to take lessons one at a time. This series is a great starting point on learning game design and programming. RUclips or google specific features tutorials like those, and learn them in a separate project. Eventually, after working on so many project, you might see how they can be put into a single project. This stuff takes a while to learn and understand, and you do not want to overwhelm yourself. Stick to this one for now, and modify this project after the fact!
am I the only one but after spending almost an hour trying to fix the code, my animation doesn't go idle, though, i did everything exactly like the video and even tryna do it myself.
This is awesome, I know there are tutorials for pixel art as well but It'd be really cool to see a full tutorial one day that goes over making all the art assets and then the game as well.
Thanks for the tutorial! As someone old to coding but new to game dev going through the different features was very helpful. I spruced up the player_movement a bit to allow diagonals, sharing here in case others are interested. I started the current_dir a bit different as well with var current_dir = "down" func player_movement(delta): velocity.x = 0 velocity.y = 0 if Input.is_action_pressed("ui_down"): current_dir = "down" velocity.y += speed if Input.is_action_pressed("ui_up"): current_dir = "up" velocity.y -= speed if Input.is_action_pressed("ui_right"): current_dir = "right" velocity.x += speed if Input.is_action_pressed("ui_left"): current_dir = "left" velocity.x -= speed if velocity.x || velocity.y: play_anim(1) else: play_anim(0) move_and_slide()
This was very helpful, thanks! I added a few lines of code right above the "if velocity.x || velocity.y:" line to fix the problem of diagonal movement being faster than straight movement: if velocity.x && velocity.y: velocity.x *= .71 velocity.y *= .71 I know the "correct" way to solve this problem is to use normalized vectors, but for simple 8-directional movement this is a quick fix that doesn't require reworking the existing code.
TYSM! I thought I was a failure when I tried this, because where it says func play_anim(movement): var dir = current_dir var anim = $CollisionShape2D/AnimatedSprite2D I forgot to write current_dir, which made the animation bug out and stop working! When I looked at it I smacked myself on my forehead and was satisfied with my sweet success! Thanks again and I will surely finish this tutorial in no time! You earned a sub ;)!
With Godot 4 there's a shortcut to 2d Topdown player movement! @export var speed = 100 func _physics(delta): var direction = Input.get_vector("left", "right", "up", "down") velocity = direction * speed move_and_slide() ("left", "right", "up", "down" = defined inputs created in my input map) That's it and your character will move in 8 directions!
First time loading Godot. I don't know coding or Godot, i'm an environment artist usually use Unreal and have wanted to dabble in pixel games and this is the most straight forward tutorial i've found yet. I tried 4 or 5 others trying to get a character to move and they all had problems and wasn't clear. I understood the code and what it was trying to accomplish. Will definitely be swapping the sprite sheets for my own down the line but its nice to have a base to start from.
i need help. im a bit lost, i followed ur tuorial step by step, triple checked that all my code is right, and made sure the script isnt a child of colision. but when i load the game, my character doesnt move or animate, im using godot 4.3, im also brand new to coding
I'm so glad you appreciated my comment, I am always looking for learning actual code and even after buying books I never feel a concrete place to start, godot keeps me hopeful@@dev-worm
do u plan to add stuff like armor, different zones with stronger enemies, inventory where you would get the loot and then you can sell it in shop and buy the better armor, weapons, potions, etc? - I haven´t watched the vid yet, I´m learning from a different tutorial atm but after i finish that I will move on this one
i plan on doing that in a future series witch will happen right after this one is finished, the game will be on survival so all that will be in the game, on this series i just want to keep it more on the simple side because of all the new players to godot 4 and to be honest im still getting used to the new functions in godot 4.
I am so glad I got in the habit of using a bit different names then you do, simply because it helps me keep track of why the things work the way they work, rather then just follow along.
Great series! I see everywhere this method, instead of using seperate directions: var moveDirection = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down",) velocity = moveDirection * speed. Can you explain which would be the difference, or the best use case for a simple movement code? func _physics_process(_delta): handleInput() updateAnim() move_and_slide()
I've been scrolling the comments wondering the same. It's tough when learning as I want to know what is the best practice. In this video we seem to use a bunch of lines to achieve a fairly simple movement controller.
I saved your playlists under "awesome tutorials", I love following along with tutorials that you get an end product thank you so much for doing it. If you're looking for ideas would love to see a 2D side scroller beat em up. Like double dragon or golden axe
When I run the game after all the script is added, I get a stiff picture of my character that moves around without animations, Godot is giving me this "AnimatedSprite2D node not found!"
I fixed it. The problem was me naming the animations starting with a capital letter, but inside the code without capital letter. I'm replying to myself to help others if they could face the same problem :)
extends CharacterBody2D # Movement speed var speed = 110 # Interaction range var interact_range = 50 # Custom velocity variable (renamed to avoid conflict with CharacterBody2D's velocity) var custom_velocity = Vector2() # Health of the player var health = 250 # Player starts with 100 health # Reference to the AnimatedSprite2D node (make sure this node exists in the player scene) @onready var animated_sprite = $AnimatedSprite2D # Make sure the node is named "AnimatedSprite2D" # State to check if the player is attacking var is_attacking = false func _ready(): pass func _process(_delta): handle_movement() handle_interaction() func handle_movement(): # If the player is attacking, don't process movement if is_attacking: return # Skip movement processing if attacking
custom_velocity = Vector2() # Reset velocity each frame
# Movement controls (WASD or Arrow keys) if Input.is_action_pressed("move_right"): custom_velocity.x += 1 if Input.is_action_pressed("move_left"): custom_velocity.x -= 1 if Input.is_action_pressed("move_down"): custom_velocity.y += 1 if Input.is_action_pressed("move_up"): custom_velocity.y -= 1
# Apply the custom velocity to the CharacterBody2D's velocity velocity = custom_velocity move_and_slide() # Flip the sprite based on movement direction if custom_velocity.x > 0: animated_sprite.scale.x = 1 # Facing right elif custom_velocity.x < 0: animated_sprite.scale.x = -1 # Facing left # Handle animations when not attacking if custom_velocity.length() > 0: play_animation("move") # Play "move" animation if moving else: play_animation("idle") # Play "idle" animation if not moving func handle_interaction(): # Check for interaction when the player presses the 'F' key if Input.is_action_just_pressed("interact"): # 'F' key for interaction var interactable = get_closest_interactable() if interactable: interactable.start_dialogue() # Check for attack when the player presses the 'attack' key if Input.is_action_just_pressed("attack") and not is_attacking: # Prevent attack spam attack() # Get the closest NPC within the interaction range func get_closest_interactable(): var interactables = get_tree().get_nodes_in_group("interactables") var closest_interactable = null var closest_distance = interact_range for interactable in interactables: var distance = global_position.distance_to(interactable.global_position) if distance < closest_distance: closest_distance = distance closest_interactable = interactable return closest_interactable # Function to play an animation based on the current state func play_animation(animation_name: String): if animated_sprite.animation != animation_name: animated_sprite.play(animation_name) # Play the specified animation # Call this function when the character takes damage func hurt(damage_amount: int): health -= damage_amount # Subtract damage from health if health
At first my intention was to use C# with Godot, since I had already started using it in Unity, but most tutorials use GDScript. Honestly, I don't mind GDScript at all and I feel like the transition in learning is pretty quick plus you don't need an external editor which simplifies the workflow.
@zawad1981 I keep rewriting it but nothing worked it just kept crashing and give 100 different errors I even tried copying and pasting working code from the comments and that gave the same 100 different errors when ever I press a button it closes
The character just stands still when I hold it, I have to keep tapping it for it to move EDIT: Nvm I'm stupid lmao... for anyone reading this make sure you're putting in the right if statements lmao
@@Que3496 Just copy exactly what he does with the code and make sure your if statements are stated correctly, that's kinda all the help I can give sorry
As the starting animation, you can just select starting animation in AnimatedSprite2D node (A+ icon in animation bar), great tutorial by the way, thanks for it!
func play_anim(movement): var dir = current_dir var anim = $AnimatedSprite2D
if dir == "right": anim.flip_h = false if movement == 1: anim.play("side_walk") elif movement == 0: anim.play("side_idle") if dir == "left": anim.flip_h = true if movement == 1: anim.play("side_walk") elif movement == 0: anim.play("side_idle") if dir == "down": anim.flip_h = true if movement == 1: anim.play("front_walk") elif movement == 0: anim.play("front_idle") if dir == "up": anim.flip_h = true if movement == 1: anim.play("back_walk") elif movement == 0: anim.play("back_idle")
i like your background music in the videos. Think it helps me to pay attention. Thanks for keeping the videos to the point and not making them hours long bc this is working for me
@@dev-worm I am having a little difficulties, i tried changing the version but it didn't work, my problem is that "Cannot call non-static function "play()" on the class "AnimatedSprite2D" directly. Make an instance instead"
Hola DevWorm te saludo desde Uruguay, no sé inglés pero algunas palabras entiendo, sumado a que he visto suficientes tutoriales en español como para ir entendiendo el razonamiento de lo que haces y/o dices por lo cual puedo seguirte sin problemas, muchisimas gracias por compartir tus conocimientos
glad to hear godot seems like the correct fit for you!! i wish you only the best with your godot journey! and if you ever need anything just let me know!!
if you use the animationplayer node instead, you can script other key changes with it, as well as play sound through audio player nodes also, you can change the speed with a slider on the character node inspector if you just "@export var" the speed variable. you can actually do a lot with this, like control the variable with other scripts
I find animation player always preferable. I get that people could use something simpler, but for any object with more than a couple frames, animation player really should be used because of the power of keyframing everything.
Hi! I have been using renpy for about five years now, and yes I love making visual novels, but think its time to branch out! I know im late, but thank you so much for making such good tutorials!
Grate tutorial. I did a few mistakes. Like making the Animatedsprite2D a child of CollisionShape2D and I also placed he elif in the wrong place, messing up my animations. But it made me read the code and understand it better trying to solve it. I like your pacing and explaining too makes it easy to look back over certain parts.
@@komahanaru i need to ask you something because you literally did my same errors! What do you mean with placed tue elif in the wrong place? Because when I play the game my character does not do the front_iele animation, it just walks on the place! Did yours have the same problem? If yes, how did you solve?
@@alieninwonderland4219 no, not particularly. Sounds like something gone wrong with the idle execution. Double-check your movement values and any capital letters. Make sure the name of the animation and what you type in the code are the exact same, capitals included. It's a common mistake when following tutorials.
This is a fantastic tutorial. I am not sure if I missed it, but when did you set the scene? I made my scene main, and then couldn't get my character to show up on the screen without dropping the player.tscn inside of my world tree. Just wondering because in the video you said 'you can play the player scene'. When I did that it the character wasn't there yet because he wasn't added to my tree. in case anyone else runs into this issue, but I have adhd so I may have just missed that small portion of the video. Thanks for the great work!
Starting this series today in hopes of learning how i'll be getting my game translated from thought to the actual system. Fingers Crossed and I'll let ya'll know how it goes🤞
Running across a slight issue with my movement. I wrote the script for the movement, and tested it, and it was working fine. I added in the scripting for changing the animations, and now while my left and right movement work fine, along with animations, my character cannot move up and down. It plays the appropriate animation for the buttons being held or let go of, but can no longer move up or down.
Hey! maybe you could help me, my problem is "Cannot call non-static function "play()" on the class "AnimatedSprite2D" directly. Make an instance instead"
it seems like you are using "if Input.is_action_just_pressed" instead of "if Input.is_action_pressed", because the "just_pressed" means it will only call it to move for one frame when the button is "just_pressed". I hope that makes sense and you can get everything working!! Goodluck!
link to the full series: ruclips.net/p/PL3cGrGHvkwn0zoGLoGorwvGj6dHCjLaGd
how did u split the sprite sheet
@@legendhowl 6/10
@@aynonms wdym
@@legendhowl 6 vertical, 10 horizontal
ik but it becomes blurry for me
i am a refugee from Unity. Thank you dev-worm for this tutorial!
I really appreciate your in-depth explanations of what things do and how
they operate.
Glad it could help!
I'm also a refugee. Thanks for the tutorial.
Same
Godot welcomes refugees of all nations!
@@1997AlexB im an unreal refugee it was tough😥
Unity refugee here; starting the toots - so far so good - no problems, easy to pick up. Thank man! See ya in the next one!
Just saying "Hi" to all the other new Godot users who have jumped ship in the past couple of days. I only just started learning game development about 4 weeks ago on Unity, I'm thinking now is a good time to focus on a different tool.
the legend is back, more powerful than before
As someone who is new to coding in general and godot, this tutorial is beyond amazing! It would be great if your future videos you made mechanics which we could simply add and expand on. Will continue to watch this series and the rest of your videos because i feel there isn't as much resources for godot 4 in terms of learning and this video alone is very inspiring! Thanks!❤
so glad to hear that, im working on some really exciting tutorials right now
THANK YOU for the work that your doing, this channel right now is the reason I havent given up again on my dream. Thank you,
Glad to hear it, Im wishing you the best and I cant wait to see your finial game!
Just as a tip if your animation doesn’t work after all the code make sure the animated sprite is a child of the player and not the collision box
BRO U SAVED MY DAY FR I WAS WONDERING FOR HOURS WTF WAS I DOING WRONG THANK YOU SO MUCH
Thanks
Bro my character literally doesn't show up at all 😭 not sure what I did wrong tho, because I literally followed this exactly
@@ValentineInWonderland same all I get is grey screen
thank you so much
Good tip for people who don't want to flip the sprite to make it go left and right (so for example you have a dedicated sprite for left and right): You can just remove the lines that say anim.flip_h = true/false on the last if statements in the player script and then type in your own animation where it otherwise would be "side_walk" and "side_idle" respectively. It worked great. Awesome tutorial.
first off, im loving the tutorial so far. im already on ep. 4 but i figured id ask this here.
i am pretty new to game dev and godot. so im pretty sure this is not the best way to go about this but id rather have my character have diagonal movement as well so i changed the code under the func player_movement(delta) part to
func player_movement(delta):
if Input.get_action_strength("Move_right"):
play_anim(1)
current_dir = "right"
elif Input.get_action_strength("Move_Left"):
play_anim(1)
current_dir = "left"
elif Input.get_action_strength("Move_Down"):
play_anim(1)
current_dir = "down"
elif Input.get_action_strength("Move_Up"):
play_anim(1)
current_dir = "up"
else:
play_anim(0)
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength("Move_right") - Input.get_action_strength("Move_Left")
input_vector.y = Input.get_action_strength("Move_Down") - Input.get_action_strength("Move_Up")
input_vector = input_vector.normalized()
if input_vector:
velocity = input_vector * speed
else:
velocity = input_vector
move_and_slide()
now heres the thing. this took me forever to try to figure out (because im new to this stuff) but everything works as i wanted it to, and im happy about it, and honestly proud of myself for getting it to work at all lol. but im just gonna ask anyone that may know more then i do, if i did something wrong here that may bite me in the butt later on.
im not asking for some nit picky answer just so you can try to flex your knowledge with an advanced answer, im only asking if, for me(a beginner thats just gonna use this tutorial to have a project to practice learning with(kinda like a starting template))
if this is a BASIC way to do this, and if its fine or not. thank you in advance
Thank you, i was searching for this, saw so many tutorials i was going to just go with it
Beginner here myself, always look at the comments of the Video. Somewhere below user @sashabellor4344 posted a script below, but it was missing a line in the func _physics section, will copy below the correct code that worked for me after I fixed it up.
@export var speed = 100
func _physics_process(_delta):
var direction = Input.get_vector("left", "right", "up", "down")
velocity = direction * speed
move_and_slide()
Voila, simple as that.. Just make sure to go into your Project > Project Settings > Input Map > Bind your keys "left" "right" "up" "down" to each separate Arrow/WASD, or the script will launch like 1000 errors a second looking for un-mapped buttons.
Good luck sir, I was getting frustrated because the code in the video wasn't working properly either, and the previous comment from Sasha was slightly off, as when I tried func _physics_process(delta) It would debug an error saying it required a _delta .. hence, func _physics_process(_delta): and for some reason this no longer spits out any debug issues + works in all 8 directions.... 4 hours later RIP Saturday Night.
Edit: After hours of frustration, this was all scrapped and followed the original tutorial, getting the animations to work was such a pain, I am sticking to what is shown to us.
@@lithium1497 Thx bro! You helped me. Hi from Brazil.
@@brakefox5106 You are very welcome! Much love from Canada
legendary yt channel, been starting gamedev and your tutorials are so good as they explain everything we want to know and implement in our games.
keep going!
I am so happy to hear that!! if you have any questions at all throughout the way feel free to let me know!
So much better and faster than the outdated one I spent all day trying to debug, THANK YOU SO DAMN MUCH.
I do need to learn how to type faster though, you type so quick I have to keep pausing and rewinding to pause it haha!
Learning from watching is tough and slow.
A few good tips:
Watch the video first.
Then follow along after.
Observe, take in what you can, and then go along with it.
You're here to learn, but you can get stuck in a mental trap by following instructions, and not having time to understand.
Also, put it to like 0x75 speed with the gear icon in RUclips.
Good stuff to learn here, but also, the instructor moves way too fast, while you are trying to follow.
No fault on them or you, this is a great series of tutorials, and there is a lot to be learned here.
Just started your series, just finished this video. Just wanted to say thank you for making this tutorial video series even though 2 years old almost this video alone has been very informative, helpful and honestly pretty cool watching few lines of code making something start to come to life.
Aww I am so glad to hear that it is still providing value. I really hope that the series helps you greatly and if you ever have any questions feel free to let me know! And that first time feeling of getting something to start moving on screen from your own work is a feeling you can never top... it is such a great feeling for sure. Goodjob and Goodluck throughout the rest of the series!
Thank you from Argentina, this video is of great help to me as I start a project I have in mind. It's undoubtedly a huge advantage to have this! Greetings.
so glad to hear that!
dude, i like how much you covered in this one video. I also had my doubts tbh with how the animation was coded in, but it worked perfectly on my end like it did on your end! Whenever that happens, you know it's an amazing tutorial. I can't wait to watch your other tutorial videos for this series!
goodluck in the rest of the series!! thanks!! if you ever need anything then please let me know!
I drank each time he says "right" and died of alcohol poisoning at 13:32
you killed me 😂😭
still thinking about this comment almost a year later. lmao
rewatching this series for the 2nd time after half a year for a new game project idea! thanks!
to move the player you could use this instead of the huge amount of if statements:-
const SPEED = 100
var direction : Vector2 = Vector2.ZERO
func _physics_process(delta):
direction = Input.get_vector("left", "right", "up", "down")
if direction:
velocity = direction * SPEED
else:
velocity = Vector2.ZERO
move_and_slide()
it works the same.
How would you implement the animation code into the character movement code?
@@doublecc6234 I used Animationtree, I learned the way from this video it is very helpful,
ruclips.net/video/WrMORzl3g1U/видео.htmlfeature=shared
Animationtree make things more simpler and easy.
The issue with this code is it adds diagonal movement if the player hits left and right at the same time. Diagonal movement in itself is not a bad thing but you will need new animations and more code to get it working. His code keeps that out and it fits top down feel better. Not saying there's not a better way.
@@TheEndTimes101 yeah to fix it add . normalized here
direction = Input.get_vector("left", "right", "up", "down"). normalized
and it should be fixed.
The other code wasn't working for me but this is. Thanks!
every godot4 tutorial maker is a hero!!!!!!!!!!!!!!
While the game I want to make isn't from this genre, this is still good practice for me to get used to working with Godot! Thanks!
I completely agree with you!! goodluck!! let me know if you need anything at all!
Thank you so much, I just finished series yesterday and tried to do this part alone and almost did it but I am happy that I found different solution to animations and it works
Really good. Well explained. Really new to Godot but used other engines, your explanation of the way the variables and functions interact in the GD script really helped and was well timed. Thanks man
At 19:30, Instead of the ready function with the animation, inside of the animated sprite 2d you can set an animation to be the default when it starts, saves some coding
but with the ready function you can have multiple different start animations for different scenes, i.e. if you want the character to start facing the right in a boss fight.
watched this video today and plan on watching the rest in the series. very helpful and informative.
so happy to hear that! thank you, hope the rest of the series is helpful
I followed your directions to the letter until 12:28 but I don't see my character on screen at all in the debug
edit: for some reason the scene was on world and not player but still cannot move my character in debug
same
If you still haven't fixed your non-moving character it may be because your input system for "ui_right" etc. only using the arrow keys, you need to put in the WASD movement yourself by going to Project --> Project Settings --> Input System (in the tab bar) --> Then putting them in for each of the ui_right ui_left. If that didn't fix it, you may not have move_and_slide() or not calling the method he made in process, or you may not have made the script differently from him and that made it not attached to the player
Also, scaling comes up shortly after, which solved mine, my guy was too tiny.
hey bro, appreciate the tutorial. always enjoy creators who present things in a fast, but concise way
I appreciate that! hope it helped!! thank you bro!
I usually favor reading over videos for learning new things, but the main benefit of video in learning game development is that you can match results much better. The problem arises when stuff doesn't work, and you have to keep scrolling for that tiny step you missed or did in another way.
I created the script using the asset tree, by right-clicking the scripts folder and adding the script. This doesn't attach the script to the CharacterBody2D node. After about half an hour of scrolling through the video, I finally noticed in the inspector that no script was attached, so I simply attached it there and it worked. Turns out I missed the click on the attach script button in the video.
Thanks for the series, it's going to be a fun one.
This was infact informative! I used to mess around in unity as a hobby years ago when I was a kid. Kinda dropped it because I just never knew what I really wanted to do with it, plus at that time I was used to writting in Java script, which did not translate well with the tutorials at the time. They were mostly wrote in C#, and trying to translate it to Java script when you barely knew code at all was rather difficult, lol.
So I've been really wanting to get back into making some games for fun, and Godot seemed like a pretty good opportunity to do so, but I just couldn't figure out a good place to start. This video has atleast given me 1/2 a mind of what I'm trying to do, and how to do certain tasks, I will will follow the rest of this series with joy, and pleasure.
Thank you good sir!
thank you!! i believe Godot is the best place of anyone to get started with development! and Im wishing you only the best!! if you ever need anything then please let me know! ill be glad to help!
Hello! Just wondering if you could do a series on how to Create a Platformer in Godot 4. It would be really cool!
one of the best tutorials i have seen so far
so happy to hear that!! thank you so much!
This is amazing. Thank you so much! As an absolute beginner, this was easy to follow. So excited for the rest of this!
so glad I could help, if there is anything else you need then please let me know.
You deserve more attention this is one of the best tutorials I've seen
so happy to hear that, thank you!
Your tutorials are the best!!!❤❤❤❤
Thank you so much :)
I have watched a lot of videos about Godot and yours are the best . Your video literally explained everything and I was able to succeed in what I was trying to do
so great to hear! if you ever need help with anything then let me know!
Pro tip: If you split it up into smaller functions such as move with move("left") and play_move with play_move("left", "side") and so on you can vastly simplify the code, more readable, composable and much less duplication. if/else and nesting statements is the bane of software dev.
So hard to find good quality tutorials for Godot 4,glad I found this one. Although for some reason if I use "delta" in the player movement function,no movement works whereas if I remove it,it works.
Edit: for some reason,Godot didn't attach the script the player node. Idk how that happened,lol. all fixed now
How did you fix it? I think I'm having the same problem.
Isn't thte whole process of picking the right animation in the code a bit convoluted? Do you really need that current_dir variable and that play_anim(1) in every if statement? I mean you could just pass the velocity vector into the function (play_anim(velocity) ), get its direction inside that func and pick the right animation with that, right?
Also concatenating the Input check with all that elif statements creates some sort of hierarchy for the inputs, with "right" having the highest and "up" the lowest.
I think you can do something like
velocity.x = Input.is_action_pressed("right") - Input.is_action_pressed("left")
velocity.y = Input.is_action_pressed("down") - Input.is_action_pressed("up")
this has less hierarchy but pressing left and right at the same time cancels each other out and it allows diagonal movement.
i was trying to keep diagonal movement out of it, but i guess that works. thanks for letting me know
Could you go more in depth of how to setup the code for the animation
Edit: it works!! Just had to multiply the integer difference by the speed value, like this:
velocity.x = speed*(int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left")))
velocity.y = speed*(int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up")))
When I copied and pasted this right after func player_movement(delta):, it says "Invalid operands "bool" and "bool" for "-" operator" and I don't know how to fix this. Is the problem about the types of values being subtracted? What should I change for this to work? Does setting the input "bool" to an "int" fix this (I thought about this when remembering a beginner Python tutorial even though it's GDScript because I assumed there's at least a similarity here) or is my lack of coding experience showing?
I just wanted to say thank you for making this tutorial. It's really easy to follow on!! 🥰
Glad it was helpful!
Thank you very much!!! you have no idea how much this video helped me out, i've tried lots of videos and i mean a LOT and still didnt get as far as i got using this video. Keep up the good work man👌
glad to hear that bro
Thank you for creating this video. It's super helpful. I liked and subscribed.
I am so glad to hear you found it helpful! thank you!
For some reason, my player just doesn’t move when I follow the script in 12:38 !
My character didn't even show up on screen.
Just use
var input_direction = Input.get_vector("left", "right", "up", "down")
velocity = input_direction * speed
Way smoother :D
This is EXACTLY what I was looking for. Thank you for your hard work!
so happy to hear that! thank you! hope everything is able to help you out!
Very helpful and at a good pace to follow along to. Thanks for that, will be continuing with this series thill the end.
glad to hear that... if you ever need any help with anything then dont be afraid to ask!
At 12:25 my character doesn't appear on the screen and move around. I'm using my own sprite and it's bigger than your character sprite if that has anything to do with it. I copied down the code exactly so I don't know what to do
yeah me too
The best tutorial about the basics in godot I've seen
What to do if you want to change your weapon characters or both do you have to make every possible combination of them
Do not worry about that just yet.
What I heard from programmers, is to take lessons one at a time.
This series is a great starting point on learning game design and programming.
RUclips or google specific features tutorials like those, and learn them in a separate project.
Eventually, after working on so many project, you might see how they can be put into a single project.
This stuff takes a while to learn and understand, and you do not want to overwhelm yourself.
Stick to this one for now, and modify this project after the fact!
@@deadjuice1880ok
This is a great tutorial. Just started Godot and came across this video. You explain things really well
Glad it was helpful! And I'm so happy to hear that!! If you ever need anything then please let me know!
am I the only one but after spending almost an hour trying to fix the code, my animation doesn't go idle, though, i did everything exactly like the video and even tryna do it myself.
This is awesome, I know there are tutorials for pixel art as well but It'd be really cool to see a full tutorial one day that goes over making all the art assets and then the game as well.
I completely agree!!
Thanks for the tutorial! As someone old to coding but new to game dev going through the different features was very helpful.
I spruced up the player_movement a bit to allow diagonals, sharing here in case others are interested. I started the current_dir a bit different as well with var current_dir = "down"
func player_movement(delta):
velocity.x = 0
velocity.y = 0
if Input.is_action_pressed("ui_down"):
current_dir = "down"
velocity.y += speed
if Input.is_action_pressed("ui_up"):
current_dir = "up"
velocity.y -= speed
if Input.is_action_pressed("ui_right"):
current_dir = "right"
velocity.x += speed
if Input.is_action_pressed("ui_left"):
current_dir = "left"
velocity.x -= speed
if velocity.x || velocity.y:
play_anim(1)
else:
play_anim(0)
move_and_slide()
This was very helpful, thanks! I added a few lines of code right above the "if velocity.x || velocity.y:" line to fix the problem of diagonal movement being faster than straight movement:
if velocity.x && velocity.y:
velocity.x *= .71
velocity.y *= .71
I know the "correct" way to solve this problem is to use normalized vectors, but for simple 8-directional movement this is a quick fix that doesn't require reworking the existing code.
code looks amazing!! good work!! thanks for sharing it for others as well!
@arcanerefrain oh nice, I've read about the diagonal problem, appreciate the lookout!
This is really going to help me achieve my vision for a game. Appreciate it.
You'll have to do the coding yourself as the code he shows doesn't work in the latest version
@@ayoungartistakajack6799 Cheers. I managed to code this section. I love coding. :)
TYSM! I thought I was a failure when I tried this, because where it says
func play_anim(movement):
var dir = current_dir
var anim = $CollisionShape2D/AnimatedSprite2D
I forgot to write current_dir, which made the animation bug out and stop working! When I looked at it I smacked myself on my forehead and was satisfied with my sweet success! Thanks again and I will surely finish this tutorial in no time! You earned a sub ;)!
thanks!! ahh i hate when something so small like that happens!! glad you could figure it out!!
your welcome!@@dev-worm
With Godot 4 there's a shortcut to 2d Topdown player movement!
@export var speed = 100
func _physics(delta):
var direction = Input.get_vector("left", "right", "up", "down")
velocity = direction * speed
move_and_slide()
("left", "right", "up", "down" = defined inputs created in my input map)
That's it and your character will move in 8 directions!
thank you! i’m sure this can help so many!
also we can remove
anim.flip_h
when moving up and down due to different sprites that don't need to be flipped.
You beauty!
This is the best method! thanks for sharing!
I needed to change "func _physics(delta):" to "func _physics_process(delta):" for it to work.
First time loading Godot. I don't know coding or Godot, i'm an environment artist usually use Unreal and have wanted to dabble in pixel games and this is the most straight forward tutorial i've found yet. I tried 4 or 5 others trying to get a character to move and they all had problems and wasn't clear. I understood the code and what it was trying to accomplish. Will definitely be swapping the sprite sheets for my own down the line but its nice to have a base to start from.
I am so happy to hear that!! I am glad to help at anytime no matter what it is that you need!! So feel free to reach out!!
i need help. im a bit lost, i followed ur tuorial step by step, triple checked that all my code is right, and made sure the script isnt a child of colision. but when i load the game, my character doesnt move or animate, im using godot 4.3, im also brand new to coding
same
Thank You. Leaving a comment for youtube engagement. Would appreciate future videos digging deeper into learning the coding language if possible
thanks man means the world! for sure!! looing into those types of tutorials now! thanks for the suggestion!
I'm so glad you appreciated my comment, I am always looking for learning actual code and even after buying books I never feel a concrete place to start, godot keeps me hopeful@@dev-worm
do u plan to add stuff like armor, different zones with stronger enemies, inventory where you would get the loot and then you can sell it in shop and buy the better armor, weapons, potions, etc?
- I haven´t watched the vid yet, I´m learning from a different tutorial atm but after i finish that I will move on this one
i plan on doing that in a future series witch will happen right after this one is finished, the game will be on survival so all that will be in the game, on this series i just want to keep it more on the simple side because of all the new players to godot 4 and to be honest im still getting used to the new functions in godot 4.
I am so glad I got in the habit of using a bit different names then you do, simply because it helps me keep track of why the things work the way they work, rather then just follow along.
Great series! I see everywhere this method, instead of using seperate directions: var moveDirection = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down",) velocity = moveDirection * speed. Can you explain which would be the difference, or the best use case for a simple movement code?
func _physics_process(_delta):
handleInput()
updateAnim()
move_and_slide()
func handleInput():
var moveDirection = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down",)
velocity = moveDirection * speed
#Anims are: Idle_LEFT, Walk_RIGHT, etc...
func updateAnim():
if velocity.length() == 0:
if $anim.is_playing():
$anim.stop()
$anim.play("Idle_" + direction)
else:
direction = "DOWN"
if velocity.x < 0 : direction = "LEFT"
elif velocity.x > 0: direction = "RIGHT"
elif velocity.y < 0: direction = "UP"
$anim.play("Walk_" + direction)
I've been scrolling the comments wondering the same. It's tough when learning as I want to know what is the best practice. In this video we seem to use a bunch of lines to achieve a fairly simple movement controller.
I saved your playlists under "awesome tutorials", I love following along with tutorials that you get an end product thank you so much for doing it. If you're looking for ideas would love to see a 2D side scroller beat em up. Like double dragon or golden axe
Ill look into it!! thanks!! hope the tutorial helps!! if you end up having issues just let me know so I can help!
When I run the game after all the script is added, I get a stiff picture of my character that moves around without animations, Godot is giving me this "AnimatedSprite2D node not found!"
I fixed it. The problem was me naming the animations starting with a capital letter, but inside the code without capital letter. I'm replying to myself to help others if they could face the same problem :)
Legend
Thank you for the tutorial! I've managed to do this :D Keep making these!
i wrote the character movement code exactly the same, stopped the video to check, than checked again. every single line of code is marked as an error.
Maybe your language is not the same as his
I know it's an old message but it's always good to let us know the error message then someone here can actually help you.
extends CharacterBody2D
# Movement speed
var speed = 110
# Interaction range
var interact_range = 50
# Custom velocity variable (renamed to avoid conflict with CharacterBody2D's velocity)
var custom_velocity = Vector2()
# Health of the player
var health = 250 # Player starts with 100 health
# Reference to the AnimatedSprite2D node (make sure this node exists in the player scene)
@onready var animated_sprite = $AnimatedSprite2D # Make sure the node is named "AnimatedSprite2D"
# State to check if the player is attacking
var is_attacking = false
func _ready():
pass
func _process(_delta):
handle_movement()
handle_interaction()
func handle_movement():
# If the player is attacking, don't process movement
if is_attacking:
return # Skip movement processing if attacking
custom_velocity = Vector2() # Reset velocity each frame
# Movement controls (WASD or Arrow keys)
if Input.is_action_pressed("move_right"):
custom_velocity.x += 1
if Input.is_action_pressed("move_left"):
custom_velocity.x -= 1
if Input.is_action_pressed("move_down"):
custom_velocity.y += 1
if Input.is_action_pressed("move_up"):
custom_velocity.y -= 1
# Normalize velocity to prevent diagonal speed boost
custom_velocity = custom_velocity.normalized() * speed
# Apply the custom velocity to the CharacterBody2D's velocity
velocity = custom_velocity
move_and_slide()
# Flip the sprite based on movement direction
if custom_velocity.x > 0:
animated_sprite.scale.x = 1 # Facing right
elif custom_velocity.x < 0:
animated_sprite.scale.x = -1 # Facing left
# Handle animations when not attacking
if custom_velocity.length() > 0:
play_animation("move") # Play "move" animation if moving
else:
play_animation("idle") # Play "idle" animation if not moving
func handle_interaction():
# Check for interaction when the player presses the 'F' key
if Input.is_action_just_pressed("interact"): # 'F' key for interaction
var interactable = get_closest_interactable()
if interactable:
interactable.start_dialogue()
# Check for attack when the player presses the 'attack' key
if Input.is_action_just_pressed("attack") and not is_attacking: # Prevent attack spam
attack()
# Get the closest NPC within the interaction range
func get_closest_interactable():
var interactables = get_tree().get_nodes_in_group("interactables")
var closest_interactable = null
var closest_distance = interact_range
for interactable in interactables:
var distance = global_position.distance_to(interactable.global_position)
if distance < closest_distance:
closest_distance = distance
closest_interactable = interactable
return closest_interactable
# Function to play an animation based on the current state
func play_animation(animation_name: String):
if animated_sprite.animation != animation_name:
animated_sprite.play(animation_name) # Play the specified animation
# Call this function when the character takes damage
func hurt(damage_amount: int):
health -= damage_amount # Subtract damage from health
if health
You did something wrong check the entire code and indents. If you want help put the script in.
im pretty well versed in c#, but for learning the built in gdscript functions i think this is a great series especially given its up to date.
At first my intention was to use C# with Godot, since I had already started using it in Unity, but most tutorials use GDScript. Honestly, I don't mind GDScript at all and I feel like the transition in learning is pretty quick plus you don't need an external editor which simplifies the workflow.
his code isn't working for me every time i fix some thing another error shows up if it not in scope or i cant move i have been trying for days
what are your errors?
@@zawad1981 Привет, ты знаешь, как сделать анимацию передвижения персонажа по диагонали? Мне бы это очень помогло
@zawad1981 I keep rewriting it but nothing worked it just kept crashing and give 100 different errors I even tried copying and pasting working code from the comments and that gave the same 100 different errors when ever I press a button it closes
@@connorburnett4245 its tough to give a solution without seeing what your errors are.
Can you paste some of them here?
Just started following this tutorial series! So excited for what's next!!
so much coming soon! hope the series helps you!
The character just stands still when I hold it, I have to keep tapping it for it to move
EDIT: Nvm I'm stupid lmao... for anyone reading this make sure you're putting in the right if statements lmao
bro how?? i don't know how to fix it, please help
@@Que3496 Just copy exactly what he does with the code and make sure your if statements are stated correctly, that's kinda all the help I can give sorry
As the starting animation, you can just select starting animation in AnimatedSprite2D node (A+ icon in animation bar), great tutorial by the way, thanks for it!
that’s a good tip! thank you! also i am so glad to hear that you liked it!
Great video, but my man, you have *got* to stop pronouncing it "go dot." It's "guh doh."
Nha it's "god ot"
No.
If they wanted the T to be silent then it wouldn't be there
Officially, it’s go-dot like ro-bot (godot robot mascot). But most people say “guh-doh”.
Do you pronounce it "jif" or "gif"?
There's only one correct answer...
extends CharacterBody2D
const speed = 100
var current_dir = "none"
func _ready():
$AnimatedSprite2D.play("front_idle")
func _physics_process(delta):
player_movement(delta)
func player_movement(delta):
if Input.is_action_pressed("ui_right"):
current_dir = "right"
play_anim(1)
velocity.x = speed
velocity.y = 0
elif Input.is_action_pressed("ui_left"):
current_dir = "left"
play_anim(1)
velocity.x = -speed
velocity.y = 0
elif Input.is_action_pressed("ui_down"):
current_dir = "down"
play_anim(1)
velocity.y = speed
velocity.x = 0
elif Input.is_action_pressed("ui_up"):
current_dir = "up"
play_anim(1)
velocity.y = -speed
velocity.x = 0
else:
play_anim(0)
velocity.x = 0
velocity.y = 0
move_and_slide()
func play_anim(movement):
var dir = current_dir
var anim = $AnimatedSprite2D
if dir == "right":
anim.flip_h = false
if movement == 1:
anim.play("side_walk")
elif movement == 0:
anim.play("side_idle")
if dir == "left":
anim.flip_h = true
if movement == 1:
anim.play("side_walk")
elif movement == 0:
anim.play("side_idle")
if dir == "down":
anim.flip_h = true
if movement == 1:
anim.play("front_walk")
elif movement == 0:
anim.play("front_idle")
if dir == "up":
anim.flip_h = true
if movement == 1:
anim.play("back_walk")
elif movement == 0:
anim.play("back_idle")
thanks legend 👍
@@TrueFalses doesn't work for me the game crashes ever time i load it
Thank goodness it worked! Thank you, kind man! =)
works but side animations don't play for me (also how do diagonals?)
edit nvm forgot I named my animations differently (still how do diagonals?)
As a Unity refugee, I thank you
I've tried a bunch of Godot tutorials gotta say this one is the clearest and worked the best for me. Keep up the good work!
so happy to hear that!! thank you!
Thank you man, here’s hoping I can use this for an adventure game
i hope everything works out for your game!! if you ever need any help just let me know!!
i got it working, this is so exciting!! thank you so much
so glad it works!
i like your background music in the videos. Think it helps me to pay attention. Thanks for keeping the videos to the point and not making them hours long bc this is working for me
Omg thank you so much. I was just struggling with the new version! Keep going👍
this series will be very helpful for sure, I learned a lot about the new godot version just from making this little game lol
@@dev-worm I am having a little difficulties, i tried changing the version but it didn't work, my problem is that "Cannot call non-static function "play()" on the class "AnimatedSprite2D" directly. Make an instance instead"
Hola DevWorm te saludo desde Uruguay, no sé inglés pero algunas palabras entiendo, sumado a que he visto suficientes tutoriales en español como para ir entendiendo el razonamiento de lo que haces y/o dices por lo cual puedo seguirte sin problemas, muchisimas gracias por compartir tus conocimientos
Thanks for the Tutorial. Starting to get into game dev and Godot seems to be fitting :D
glad to hear godot seems like the correct fit for you!! i wish you only the best with your godot journey! and if you ever need anything just let me know!!
tysm!! this series is going to help a lot for sure....❤
if you use the animationplayer node instead, you can script other key changes with it, as well as play sound through audio player nodes
also, you can change the speed with a slider on the character node inspector if you just "@export var" the speed variable. you can actually do a lot with this, like control the variable with other scripts
Where would one be able to find a more in depth explanation or tutorial of what you're talking about?
I find animation player always preferable. I get that people could use something simpler, but for any object with more than a couple frames, animation player really should be used because of the power of keyframing everything.
Hi! I have been using renpy for about five years now, and yes I love making visual novels, but think its time to branch out! I know im late, but thank you so much for making such good tutorials!
thank you!! I am just glad to help!! I wish you only the best in your Godot journey!! If you ever have any questions feel free to reach out!!
Such an easy-to-follow tutorial thxs a bunch!
so glad to hear that!!
Holy cow my dude, BREATHE! I slowed it down to 0.75 speed and I'm still constantly pausing to catch up. xD
ah i’m sorry!! hope you were still able to get all the information out of it!
I just found this series , I'm so exited to start it
really good tutorial!!!!, im gonna make an cool rpg now. (using undertale sprites as placeholders lolll)
Ooo goodluck!! keep me updated for sure!
Grate tutorial. I did a few mistakes. Like making the Animatedsprite2D a child of CollisionShape2D
and I also placed he elif in the wrong place, messing up my animations.
But it made me read the code and understand it better trying to solve it.
I like your pacing and explaining too makes it easy to look back over certain parts.
@@komahanaru i need to ask you something because you literally did my same errors! What do you mean with placed tue elif in the wrong place? Because when I play the game my character does not do the front_iele animation, it just walks on the place! Did yours have the same problem? If yes, how did you solve?
@@alieninwonderland4219 no, not particularly. Sounds like something gone wrong with the idle execution.
Double-check your movement values and any capital letters. Make sure the name of the animation and what you type in the code are the exact same, capitals included. It's a common mistake when following tutorials.
Thank you for this tutorial. I am glad that i found this one!!
glad to hear, thank you! hoping everything is working smoothly for you!
This is a fantastic tutorial. I am not sure if I missed it, but when did you set the scene? I made my scene main, and then couldn't get my character to show up on the screen without dropping the player.tscn inside of my world tree. Just wondering because in the video you said 'you can play the player scene'. When I did that it the character wasn't there yet because he wasn't added to my tree. in case anyone else runs into this issue, but I have adhd so I may have just missed that small portion of the video. Thanks for the great work!
I love the video and though I had some issues I did learn alot so thank you vary much!
i am so glad you were able to overcome the issues!! and happy to hear you learned a lot!! goodjob!
15:21 Why not use the current velocity to determine which direction the player is facing? No need for a separate variable
Thanks man this is awesome especially since most tutorials are still stuck on Godot 3
great video, clear and concise
Hey, thank you for covering this, one thing I wanna know is what would I do to make a party following system, I'd appreciate it
Starting this series today in hopes of learning how i'll be getting my game translated from thought to the actual system. Fingers Crossed and I'll let ya'll know how it goes🤞
Running across a slight issue with my movement. I wrote the script for the movement, and tested it, and it was working fine. I added in the scripting for changing the animations, and now while my left and right movement work fine, along with animations, my character cannot move up and down. It plays the appropriate animation for the buttons being held or let go of, but can no longer move up or down.
I fixed it! The character mustve been stuck on the x axis somehow, moving him slightly more towards the center of the room made it all suddenly work.
Hey! maybe you could help me, my problem is "Cannot call non-static function "play()" on the class "AnimatedSprite2D" directly. Make an instance instead"
12:20 i did everything same,but my character doesn't move like in the video it moves like 1 block per every click and it doesn't go by
it seems like you are using "if Input.is_action_just_pressed" instead of "if Input.is_action_pressed", because the "just_pressed" means it will only call it to move for one frame when the button is "just_pressed". I hope that makes sense and you can get everything working!! Goodluck!
@@dev-worm ohh okay thanks
You may be the Griffpatch of Godot sir. Thank you for the amazing tutorial!
I have been waiting for this player
What a great start!