How to Create an RPG in Godot 4 (step by step)

  Рет қаралды 335,622

DevWorm

DevWorm

Күн бұрын

Пікірлер: 842
@dev-worm
@dev-worm Жыл бұрын
link to the full series: kzbin.info/aero/PL3cGrGHvkwn0zoGLoGorwvGj6dHCjLaGd
@legendhowl
@legendhowl Жыл бұрын
how did u split the sprite sheet
@aynonms
@aynonms Жыл бұрын
@@legendhowl 6/10
@legendhowl
@legendhowl Жыл бұрын
@@aynonms wdym
@aynonms
@aynonms Жыл бұрын
@@legendhowl 6 vertical, 10 horizontal
@legendhowl
@legendhowl Жыл бұрын
ik but it becomes blurry for me
@Marandal
@Marandal Жыл бұрын
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.
@dev-worm
@dev-worm Жыл бұрын
Glad it could help!
@idontknoq4813
@idontknoq4813 11 ай бұрын
I'm also a refugee. Thanks for the tutorial.
@Vocodedvoice
@Vocodedvoice 11 ай бұрын
Same
@1997AlexB
@1997AlexB 10 ай бұрын
Godot welcomes refugees of all nations!
@enderpig99
@enderpig99 10 ай бұрын
@@1997AlexB im an unreal refugee it was tough😥
@microwire007
@microwire007 Жыл бұрын
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.
@Diertstarr
@Diertstarr Жыл бұрын
Unity refugee here; starting the toots - so far so good - no problems, easy to pick up. Thank man! See ya in the next one!
@SkillSage-p3r
@SkillSage-p3r 10 ай бұрын
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
@doublecc6234 10 ай бұрын
How would you implement the animation code into the character movement code?
@SkillSage-p3r
@SkillSage-p3r 10 ай бұрын
@@doublecc6234 I used Animationtree, I learned the way from this video it is very helpful, kzbin.info/www/bejne/jaOwgIWwoZiaZ7cfeature=shared Animationtree make things more simpler and easy.
@TheEndTimes101
@TheEndTimes101 6 ай бұрын
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.
@SkillSage-p3r
@SkillSage-p3r 6 ай бұрын
@@TheEndTimes101 yeah to fix it add . normalized here direction = Input.get_vector("left", "right", "up", "down"). normalized and it should be fixed.
@CozyThreadsAU
@CozyThreadsAU 3 ай бұрын
The other code wasn't working for me but this is. Thanks!
@LoganSie
@LoganSie Жыл бұрын
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!❤
@dev-worm
@dev-worm Жыл бұрын
so glad to hear that, im working on some really exciting tutorials right now
@ilguardiano8718
@ilguardiano8718 Жыл бұрын
the legend is back, more powerful than before
@qmerk2661
@qmerk2661 5 ай бұрын
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
@aintnico
@aintnico 3 ай бұрын
Thank you, i was searching for this, saw so many tutorials i was going to just go with it
@lithium1497
@lithium1497 3 ай бұрын
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.
@brakefox5106
@brakefox5106 3 ай бұрын
@@lithium1497 Thx bro! You helped me. Hi from Brazil.
@lithium1497
@lithium1497 3 ай бұрын
@@brakefox5106 You are very welcome! Much love from Canada
@Boerke
@Boerke 3 ай бұрын
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.
@abnorth2276
@abnorth2276 Ай бұрын
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.
@ninjacodertech
@ninjacodertech Ай бұрын
rewatching this series for the 2nd time after half a year for a new game project idea! thanks!
@missharley2118
@missharley2118 Жыл бұрын
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!
@deadjuice1880
@deadjuice1880 7 ай бұрын
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 KZbin. 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.
@ericspeak6110
@ericspeak6110 Жыл бұрын
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,
@dev-worm
@dev-worm Жыл бұрын
Glad to hear it, Im wishing you the best and I cant wait to see your finial game!
@Makiyes-gaming
@Makiyes-gaming Жыл бұрын
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
@mohamedbennasroune7633
@mohamedbennasroune7633 Жыл бұрын
BRO U SAVED MY DAY FR I WAS WONDERING FOR HOURS WTF WAS I DOING WRONG THANK YOU SO MUCH
@gripychipy
@gripychipy 8 ай бұрын
Thanks
@ValentineInWonderland
@ValentineInWonderland 5 ай бұрын
Bro my character literally doesn't show up at all 😭 not sure what I did wrong tho, because I literally followed this exactly
@jeremiahhoney650
@jeremiahhoney650 5 ай бұрын
@@ValentineInWonderland same all I get is grey screen
@themaplerunner3994
@themaplerunner3994 Ай бұрын
thank you so much
@mooonchen4822
@mooonchen4822 Күн бұрын
Just use var input_direction = Input.get_vector("left", "right", "up", "down") velocity = input_direction * speed Way smoother :D
@tomoyaokazaki2138
@tomoyaokazaki2138 6 ай бұрын
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!
@dev-worm
@dev-worm 6 ай бұрын
goodluck in the rest of the series!! thanks!! if you ever need anything then please let me know!
@gonzaloramirez3261
@gonzaloramirez3261 Жыл бұрын
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.
@dev-worm
@dev-worm Жыл бұрын
so glad to hear that!
@degariuslozak2169
@degariuslozak2169 11 ай бұрын
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
@Yinithyn
@Yinithyn 11 ай бұрын
How did you fix it? I think I'm having the same problem.
@BeardyRamblinGames
@BeardyRamblinGames Ай бұрын
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
@RansomeColeman
@RansomeColeman 5 ай бұрын
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()
@arcanerefrain
@arcanerefrain 5 ай бұрын
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.
@dev-worm
@dev-worm 5 ай бұрын
code looks amazing!! good work!! thanks for sharing it for others as well!
@RansomeColeman
@RansomeColeman 5 ай бұрын
@arcanerefrain oh nice, I've read about the diagonal problem, appreciate the lookout!
@JayTohab
@JayTohab 6 ай бұрын
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!
@dev-worm
@dev-worm 6 ай бұрын
I completely agree with you!! goodluck!! let me know if you need anything at all!
@sanitycheck574
@sanitycheck574 Жыл бұрын
every godot4 tutorial maker is a hero!!!!!!!!!!!!!!
@dabbasthegreat
@dabbasthegreat 12 күн бұрын
one of the best tutorials i have seen so far
@dev-worm
@dev-worm 11 күн бұрын
so happy to hear that!! thank you so much!
@pafinnoobmufin5037
@pafinnoobmufin5037 Жыл бұрын
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
@BigJim1976
@BigJim1976 7 ай бұрын
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!
@dev-worm
@dev-worm 7 ай бұрын
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!
@kristianlavigne8270
@kristianlavigne8270 11 ай бұрын
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.
@dallisfrancis1136
@dallisfrancis1136 Жыл бұрын
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
@dev-worm
@dev-worm 11 ай бұрын
so great to hear! if you ever need help with anything then let me know!
@eddyxc1697
@eddyxc1697 5 ай бұрын
hey bro, appreciate the tutorial. always enjoy creators who present things in a fast, but concise way
@dev-worm
@dev-worm 5 ай бұрын
I appreciate that! hope it helped!! thank you bro!
@RM_3D
@RM_3D 3 ай бұрын
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.
@dev-worm
@dev-worm 3 ай бұрын
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!!
@funmtg1272
@funmtg1272 10 ай бұрын
watched this video today and plan on watching the rest in the series. very helpful and informative.
@dev-worm
@dev-worm 10 ай бұрын
so happy to hear that! thank you, hope the rest of the series is helpful
@MijmerMopper
@MijmerMopper 10 ай бұрын
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.
@gruby4498
@gruby4498 2 ай бұрын
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!
@dev-worm
@dev-worm 2 ай бұрын
that’s a good tip! thank you! also i am so glad to hear that you liked it!
@sashabellor4344
@sashabellor4344 5 ай бұрын
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!
@dev-worm
@dev-worm 5 ай бұрын
thank you! i’m sure this can help so many!
@hansuswurstus888
@hansuswurstus888 2 ай бұрын
also we can remove anim.flip_h when moving up and down due to different sprites that don't need to be flipped.
@PoloKid
@PoloKid 2 ай бұрын
You beauty!
@Xalantor
@Xalantor 10 ай бұрын
This is EXACTLY what I was looking for. Thank you for your hard work!
@dev-worm
@dev-worm 10 ай бұрын
so happy to hear that! thank you! hope everything is able to help you out!
@indieviktorian7206
@indieviktorian7206 Жыл бұрын
Your tutorials are the best!!!❤❤❤❤
@dev-worm
@dev-worm Жыл бұрын
Thank you so much :)
@glitcheddivinity
@glitcheddivinity Жыл бұрын
This is amazing. Thank you so much! As an absolute beginner, this was easy to follow. So excited for the rest of this!
@dev-worm
@dev-worm Жыл бұрын
so glad I could help, if there is anything else you need then please let me know.
@ricardogaudi2754
@ricardogaudi2754 Жыл бұрын
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👌
@dev-worm
@dev-worm Жыл бұрын
glad to hear that bro
@minkhe
@minkhe 9 ай бұрын
You deserve more attention this is one of the best tutorials I've seen
@dev-worm
@dev-worm 9 ай бұрын
so happy to hear that, thank you!
@GyHUN95
@GyHUN95 Жыл бұрын
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)
@MetaDataAutomation
@MetaDataAutomation 9 ай бұрын
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.
@fleurspr5432
@fleurspr5432 Жыл бұрын
I just wanted to say thank you for making this tutorial. It's really easy to follow on!! 🥰
@dev-worm
@dev-worm Жыл бұрын
Glad it was helpful!
@--sql
@--sql Ай бұрын
This is really going to help me achieve my vision for a game. Appreciate it.
@ayoungartistakajack6799
@ayoungartistakajack6799 Ай бұрын
You'll have to do the coding yourself as the code he shows doesn't work in the latest version
@--sql
@--sql Ай бұрын
​@@ayoungartistakajack6799 Cheers. I managed to code this section. I love coding. :)
@InconnuO_O491
@InconnuO_O491 Жыл бұрын
The best tutorial about the basics in godot I've seen
@armyofchickens6062
@armyofchickens6062 Жыл бұрын
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
@davidbouman8928
@davidbouman8928 Жыл бұрын
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.
@Carmidian
@Carmidian 5 ай бұрын
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
@dev-worm
@dev-worm 5 ай бұрын
Ill look into it!! thanks!! hope the tutorial helps!! if you end up having issues just let me know so I can help!
@dr.goshleorio8343
@dr.goshleorio8343 4 ай бұрын
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!
@dev-worm
@dev-worm 4 ай бұрын
so happy to hear that!! thank you!
@ingred4860
@ingred4860 3 ай бұрын
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!
@dev-worm
@dev-worm 3 ай бұрын
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!!
@billathonjohn
@billathonjohn 8 ай бұрын
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 ;)!
@dev-worm
@dev-worm 8 ай бұрын
thanks!! ahh i hate when something so small like that happens!! glad you could figure it out!!
@billathonjohn
@billathonjohn 8 ай бұрын
your welcome!@@dev-worm
@ethandfriends2
@ethandfriends2 3 ай бұрын
Thank you man, here’s hoping I can use this for an adventure game
@dev-worm
@dev-worm 3 ай бұрын
i hope everything works out for your game!! if you ever need any help just let me know!!
@chonkhihumtsoe4879
@chonkhihumtsoe4879 11 ай бұрын
This is a great tutorial. Just started Godot and came across this video. You explain things really well
@dev-worm
@dev-worm 11 ай бұрын
Glad it was helpful! And I'm so happy to hear that!! If you ever need anything then please let me know!
@aChannel13813
@aChannel13813 Жыл бұрын
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.
@casachezdoom2588
@casachezdoom2588 4 ай бұрын
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.
@1997AlexB
@1997AlexB 10 ай бұрын
Very helpful and at a good pace to follow along to. Thanks for that, will be continuing with this series thill the end.
@dev-worm
@dev-worm 10 ай бұрын
glad to hear that... if you ever need any help with anything then dont be afraid to ask!
@mariamejia936
@mariamejia936 8 ай бұрын
Thank You. Leaving a comment for youtube engagement. Would appreciate future videos digging deeper into learning the coding language if possible
@dev-worm
@dev-worm 8 ай бұрын
thanks man means the world! for sure!! looing into those types of tutorials now! thanks for the suggestion!
@mariamejia936
@mariamejia936 7 ай бұрын
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
@demiangarden
@demiangarden Жыл бұрын
Just started following this tutorial series! So excited for what's next!!
@dev-worm
@dev-worm Жыл бұрын
so much coming soon! hope the series helps you!
@Jardras
@Jardras 3 ай бұрын
Thanks for the Tutorial. Starting to get into game dev and Godot seems to be fitting :D
@dev-worm
@dev-worm 3 ай бұрын
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!!
@AMINEI-wl9rk
@AMINEI-wl9rk 6 ай бұрын
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")
@TrueFalses
@TrueFalses 6 ай бұрын
thanks legend 👍
@connorburnett4245
@connorburnett4245 6 ай бұрын
@@TrueFalses doesn't work for me the game crashes ever time i load it
@Wolfframe
@Wolfframe 3 ай бұрын
Thank goodness it worked! Thank you, kind man! =)
@voidcatling
@voidcatling 19 күн бұрын
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?)
@lexolotlgod
@lexolotlgod 4 ай бұрын
Holy cow my dude, BREATHE! I slowed it down to 0.75 speed and I'm still constantly pausing to catch up. xD
@dev-worm
@dev-worm 4 ай бұрын
ah i’m sorry!! hope you were still able to get all the information out of it!
@deadjuice1880
@deadjuice1880 8 ай бұрын
Not a necessity, but if like me, you want to use WASD instead of the arrow keys: Just change if Input.is_action_pressed("ui_right"): to if Input.is_key_pressed(KEY_D) For clarification, you gotta change. is_action_pressed to is_key_pressed For all of them. And remember, (KEY_D) does not have "" around it like ("ui_right") "ui_right" is calling a predefiened String, while KEY_D is calling a raw input. I _believeeee_ that's what is going on. But, it works for me.
@TheEndTimes101
@TheEndTimes101 6 ай бұрын
Or better yet make a input for them in the settings and call that. Doing it that way lets you switch key on the fly later on.
@deadjuice1880
@deadjuice1880 6 ай бұрын
@@TheEndTimes101 Should have mentioned that option. It's very useful, and saves headaches down the line. I'm still learning, so I personally want to utilize the script language as much as I possibly can. Godot is a very good editor. Let it help.
@MonkeySense
@MonkeySense 9 ай бұрын
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.
@rjyo1236
@rjyo1236 4 ай бұрын
Maybe your language is not the same as his
@TheNerdyTannator
@TheNerdyTannator 2 ай бұрын
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.
@MootPotato
@MootPotato 11 ай бұрын
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
@komahanaru
@komahanaru 3 ай бұрын
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.
@alieninwonderland4219
@alieninwonderland4219 2 ай бұрын
@@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?
@komahanaru
@komahanaru 2 ай бұрын
​@@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.
@randykeith1203
@randykeith1203 10 ай бұрын
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
@narrow_way12
@narrow_way12 10 ай бұрын
same
@Picksol
@Picksol 10 ай бұрын
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
@Olon97
@Olon97 2 ай бұрын
Going to point my students this way, but it would have been nice if you used enum (or at least constants) instead of just a number for direction/animation. # Define an enum for the four cardinal directions enum Direction { FRONT, # Value is 0 BACK, # Value is 1 LEFT, # Value is 2 RIGHT # Value is 3 }
@Slipping_thru_the_Seams
@Slipping_thru_the_Seams Жыл бұрын
i got it working, this is so exciting!! thank you so much
@dev-worm
@dev-worm Жыл бұрын
so glad it works!
@DremorusReborn
@DremorusReborn Жыл бұрын
Thank you for the tutorial! I've managed to do this :D Keep making these!
@RicardoLeidenz
@RicardoLeidenz Жыл бұрын
As a Unity refugee, I thank you
@calebcasual
@calebcasual Жыл бұрын
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.
@dev-worm
@dev-worm Жыл бұрын
I completely agree!!
@ThePixelPal
@ThePixelPal Жыл бұрын
Such an easy-to-follow tutorial thxs a bunch!
@dev-worm
@dev-worm Жыл бұрын
so glad to hear that!!
@aneerudh1712
@aneerudh1712 Жыл бұрын
Omg thank you so much. I was just struggling with the new version! Keep going👍
@dev-worm
@dev-worm Жыл бұрын
this series will be very helpful for sure, I learned a lot about the new godot version just from making this little game lol
@Welebam5308
@Welebam5308 9 ай бұрын
@@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"
@chase7767
@chase7767 11 ай бұрын
I drank each time he says "right" and died of alcohol poisoning at 13:32
@mathislalonde353
@mathislalonde353 9 ай бұрын
you killed me 😂😭
@Andrewisnotedible
@Andrewisnotedible 12 күн бұрын
still thinking about this comment almost a year later. lmao
@h-angrygirl
@h-angrygirl 7 ай бұрын
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
@peterashrafchess
@peterashrafchess 4 күн бұрын
za end code extends CharacterBody2D const SPEED = 100.0 var current_dir = "none" func _physics_process(delta: float) -> void: player_movement(delta) func player_movement(delta): if Input.is_action_pressed("right"): current_dir = "right" anim(1) velocity.x = SPEED velocity.y = 0 elif Input.is_action_pressed("left"): current_dir = "left" anim(1) velocity.x = -SPEED velocity.y = 0 elif Input.is_action_pressed("up"): current_dir = "up" anim(1) velocity.x = 0 velocity.y = -SPEED elif Input.is_action_pressed("down"): current_dir = "down" anim(1) velocity.x = 0 velocity.y = SPEED else: anim(0) velocity = Vector2.ZERO move_and_slide() func anim(move): var dir = current_dir var anim = $AnimatedSprite2D if (dir == "right"): if (move == 1): anim.flip_h = false anim.play("run_s") else: anim.flip_h = false anim.play("idle_s") elif (dir == "left"): if (move == 1): anim.flip_h = true anim.play("run_s") else: anim.flip_h = true anim.play("idle_s") elif (dir == "up"): if (move == 1): anim.play("run_b") else: anim.play("idle_b") elif (dir == "down"): if (move == 1): anim.play("run_f") else: anim.play("idle_f")
@JaiLeeroy
@JaiLeeroy Жыл бұрын
You may be the Griffpatch of Godot sir. Thank you for the amazing tutorial!
@davildur
@davildur 9 ай бұрын
Thank you for this tutorial. I am glad that i found this one!!
@dev-worm
@dev-worm 8 ай бұрын
glad to hear, thank you! hoping everything is working smoothly for you!
@gametube1375
@gametube1375 Жыл бұрын
I have been waiting for this player
@keithestanol3771
@keithestanol3771 Жыл бұрын
Thank you for this! This first one was easy to follow the somewhat complex concepts and I managed to get it working. I've bought the premium art pack and I'll be busy with all 8 of the videos in this series. Again, SO MUCH THANKS! I'm coming in from pygame for what it's worth.
@tommasotezza1319
@tommasotezza1319 Жыл бұрын
I just found this series , I'm so exited to start it
@General_Havoc
@General_Havoc Жыл бұрын
Hello! Just wondering if you could do a series on how to Create a Platformer in Godot 4. It would be really cool!
@MrMaxiDPM
@MrMaxiDPM 2 ай бұрын
really good tutorial!!!!, im gonna make an cool rpg now. (using undertale sprites as placeholders lolll)
@dev-worm
@dev-worm 2 ай бұрын
Ooo goodluck!! keep me updated for sure!
@vladcozma687
@vladcozma687 Жыл бұрын
I Found a better way to make the movement with less boilerplate: func player_movement(delta): if Input.is_action_pressed("down"): velocity = Vector2(0, speed) elif Input.is_action_pressed("up"): velocity = Vector2(0, -speed) elif Input.is_action_pressed("left"): velocity = Vector2(-speed, 0) elif Input.is_action_pressed("right"): velocity = Vector2(speed, 0) else: velocity = Vector2(0,0) I used "down", "right", "left", "up" because i put the keys into the Input map, also used Vector2 for less work. everything else should be pretty easy to understand
@vladcozma687
@vladcozma687 Жыл бұрын
Also a lot less boilerplate for the sprite making using match function match dir: "right": anim.flip_h = false if movement == 1: anim.play("side-walk") elif movement == 0: anim.play("side_idle") "left": anim.flip_h = true if movement == 1: anim.play("side-walk") elif movement == 0: anim.play("side_idle") "down": if movement == 1: anim.play("front-walk") elif movement == 0: anim.play("front_idle") "up": if movement == 1: anim.play("back-walk") elif movement == 0: anim.play("back_idle")
@mihirparab2172
@mihirparab2172 Жыл бұрын
tysm!! this series is going to help a lot for sure....❤
@marshmellow9834
@marshmellow9834 3 ай бұрын
I love the video and though I had some issues I did learn alot so thank you vary much!
@dev-worm
@dev-worm 3 ай бұрын
i am so glad you were able to overcome the issues!! and happy to hear you learned a lot!! goodjob!
@robfrydryck127
@robfrydryck127 Жыл бұрын
What a great start!
@Quantum_phy
@Quantum_phy 8 ай бұрын
What to do if you want to change your weapon characters or both do you have to make every possible combination of them
@deadjuice1880
@deadjuice1880 7 ай бұрын
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. KZbin 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!
@Quantum_phy
@Quantum_phy 7 ай бұрын
​@@deadjuice1880ok
@MrSevenEleven
@MrSevenEleven Жыл бұрын
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
@Blitz289581
@Blitz289581 Жыл бұрын
Where would one be able to find a more in depth explanation or tutorial of what you're talking about?
@nobodyinparticular80
@nobodyinparticular80 11 ай бұрын
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.
@Nesisorator
@Nesisorator Жыл бұрын
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.
@dev-worm
@dev-worm Жыл бұрын
i was trying to keep diagonal movement out of it, but i guess that works. thanks for letting me know
@doublecc6234
@doublecc6234 10 ай бұрын
Could you go more in depth of how to setup the code for the animation
@masicbemester
@masicbemester 8 ай бұрын
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?
@teu2387
@teu2387 Жыл бұрын
Goat channel 😍
@dev-worm
@dev-worm Жыл бұрын
thanks bro means the world
@teu2387
@teu2387 Жыл бұрын
@@dev-worm np keep up the good work bro 🙏🙏
@mdnghtppl0000
@mdnghtppl0000 Жыл бұрын
great video, clear and concise
@sashax2845
@sashax2845 2 ай бұрын
Maaan its awesom!! thank you a lot!!! finnaly iv made 8way isometric animation without AnimationPlayer wich is only good for killing left mouse button and my nerves
@dev-worm
@dev-worm 2 ай бұрын
haha!! if you need any help feel free to ask!! Im here for you bro!
@drinkwwwaterrr
@drinkwwwaterrr Жыл бұрын
Thanks man this is awesome especially since most tutorials are still stuck on Godot 3
@TheCameraGamer-e3w
@TheCameraGamer-e3w 26 күн бұрын
I am just starting game development and I could see how this could be a really good firs game.
@dev-worm
@dev-worm 23 күн бұрын
welcome to game dev!! it really is a fun journey and I recommend you give it a shot and see how you like it!! goodluck if you decide to work through this series or any other tutorial series on youtube i know there are some great ones out there!! but if you have any questions related around godot feel free to ask!
@0liwiersky
@0liwiersky Жыл бұрын
its my first game in godot ever (apart from the one where I added a 3D model and gave up) and i'm literally crying 😭
@ros1eeee
@ros1eeee 6 ай бұрын
Super helpful!! Thank you!!
@dev-worm
@dev-worm 6 ай бұрын
thank you! goodluck in the rest of the series! and if you have any questions then please let me know!
@miaoumixed4268
@miaoumixed4268 Жыл бұрын
Thank you for this tutorial. Coming from "another engine" and for now, it is very easy to follow and understand as I have some background in 2D logic. Your explanations are clear and very helpful.
@dev-worm
@dev-worm 11 ай бұрын
So great to hear, thanks. And Glad I could help!
@lipea56
@lipea56 Жыл бұрын
Omg looks so good, awesome!!!!! :O
@WanderfromSOTC
@WanderfromSOTC 3 ай бұрын
Hopefully I will push through and finally make a game.
@dev-worm
@dev-worm 3 ай бұрын
i wish you luck!! my advice to you is to not rush yourself but to try and stay consistent!! If you ever need any help just let me know!! im here for you!!
@ragtimeragdoll7803
@ragtimeragdoll7803 Ай бұрын
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
@Sugomaturu96
@Sugomaturu96 Ай бұрын
yeah me too
@cbjaxx1413
@cbjaxx1413 Жыл бұрын
THIS MADE MY DAY
@devinegamingtv3427
@devinegamingtv3427 5 ай бұрын
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!"
@devinegamingtv3427
@devinegamingtv3427 5 ай бұрын
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 :)
@Leonidas_CJ
@Leonidas_CJ 4 ай бұрын
Legend
@NFDL-Productions
@NFDL-Productions Күн бұрын
const speed = 250 var current_dir = "none" func player_movement(delta): if Input.is_action_pressed("right"): current_dir = "right" play_anim(1) velocity.x = speed velocity.y = 0 elif Input.is_action_pressed("left"): current_dir = "left" velocity. x = -speed play_anim(1) velocity.y = 0 elif Input.is_action_pressed("down"): current_dir = "down" play_anim(1) velocity.y = speed velocity.x = 0 elif Input.is_action_pressed("up"): current_dir = "up" play_anim(1) velocity.y = -speed velocity.x = 0 else: play_anim(0) velocity.x = 0 velocity.y = 0
@ipodblade
@ipodblade Жыл бұрын
Top tier channel 🗣️🗣️🔥🔥🔥
@dev-worm
@dev-worm Жыл бұрын
really appreciate that bro
How to Use TILESETS in Godot 4
14:47
DevWorm
Рет қаралды 104 М.
How to make a Video Game - Godot Beginner Tutorial
1:17:12
Brackeys
Рет қаралды 2,3 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 32 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 104 МЛН
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
BeatboxJCOP
Рет қаралды 60 МЛН
Creating SMART enemies from scratch! | Devlog
5:40
Challacade
Рет қаралды 353 М.
Technique for Creating Beautiful Level Design
11:48
Pixel Architect
Рет қаралды 891 М.
How To Make a FIGHTING GAME In Godot! [Complete Course]
29:00
How Much Money my Mobile Game Made (After 1 month)
5:24
SimonKv GameDev
Рет қаралды 990 М.
I Made a Graphics Engine in Scratch
8:27
Zyger
Рет қаралды 189 М.
6 DEVS Compete to Make the BEST GAME for $10,000
38:22
Blackthornprod
Рет қаралды 694 М.
I made a game using Godot for the first time
7:35
shawcat
Рет қаралды 1,3 МЛН
3 Hours vs. 3 Years of Blender
17:44
Isto Inc.
Рет қаралды 5 МЛН
Running "Hello World!" in 10 FORBIDDEN Programming Languages
18:07
How To Pixel Art In 10 Minutes | Pixel Art Tutorial
10:04
Reece Geofroy
Рет қаралды 953 М.
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 32 МЛН