Player movement and Animation - Godot 4 Platformer Tutorial - Part 1

  Рет қаралды 24,496

GameDevKnight

GameDevKnight

Күн бұрын

In this video we covered platforming in Godot and setting up a simple player controller with his idle animation.
Buy me a coffee - ko-fi.com/gamedevknight
Discord - / discord
Instagram - / gamedevknight
twitter - / gamedevknightt
Assetpack:
pixelfrog-assets.itch.io/trea...
0:00 Intro
0:10 Create Scene
0:36 Sprites
1:05 Platform
2:09 Pixel Blur Fix
2:44 Saving Platform
2:58 Camera Settings
4:28 Layout Platforms
4:51 Create Player
6:04 Animate Player
7:43 Player Script
9:04 Save Player
9:42 Testing Script
10:28 Movement Input
11:32 Test Movement
11:44 Play Animation
13:22 Set Main Scene
13:37 Flip Player
15:28 Cleaning Code
15:40 End Result

Пікірлер: 57
@ahmedkhabar
@ahmedkhabar 11 ай бұрын
To flip the sprite2D u can use flip-h attribute and set the value to True.
@accumulator4825
@accumulator4825 Жыл бұрын
This was really an awesome tutorial, keep it up!!!
@pietraderdetective8953
@pietraderdetective8953 9 ай бұрын
This tutorial is awesome..I just liked every videos in the playlist ❤ You deserve a lot more views and subscribers Sir!
@GameDevKnight
@GameDevKnight 9 ай бұрын
Thanks a lot man the comments help a lot, you're a beast
@AISweb2023
@AISweb2023 Жыл бұрын
Thanks! The sprite flip trick was very useful.
@GameDevKnight
@GameDevKnight Жыл бұрын
You're welcome man!
@CoolCraft-xy1mq
@CoolCraft-xy1mq 9 ай бұрын
Best Video Ever This really helped alot
@GameDevKnight
@GameDevKnight 9 ай бұрын
Thanks man
@mikkyv
@mikkyv Жыл бұрын
Great tutorial!
@benkazadi1856
@benkazadi1856 5 ай бұрын
thanks man you helped out a ton
@GameDevKnight
@GameDevKnight 5 ай бұрын
no, thank you brother for the comment!
@redwolf6334
@redwolf6334 2 ай бұрын
Thank you so much 🙏
@karlkrause1451
@karlkrause1451 10 ай бұрын
thank you!
@GameDevKnight
@GameDevKnight 10 ай бұрын
You're welcome!
@muajin
@muajin Жыл бұрын
Hi. Do you by chance know how to fix the velocity error when bringing over a project that was made in a previous version of Godot?
@GameDevKnight
@GameDevKnight Жыл бұрын
So a few things have had their I guess syntax changed? Like when you do move_and_slide() it use to require you to pass it the velocity like so move_and_slide(velocity), but now it's all built into the character body, it was just made more simple so any velocity errors you get try removing the velocity variable and also dont declare your own velocity variable called velocity because like I said it is built into the character body, if you need more help feel free to join discord and maybe send a screenshot of the errors you're getting and I can help there.
@krisshorts704
@krisshorts704 3 ай бұрын
Hey! My player cannot attack on the ground but it can do aerial attacks. Do you possibly know how to fix this issue? Thank you!
@Dinogurkmacka
@Dinogurkmacka 2 ай бұрын
Can you help? Im trying to get the sprite folder you use for these videos but the discord invite is not working. Pls help.
@HippocritterXD
@HippocritterXD 8 ай бұрын
love the turorial: but i had a question, why not make an tilemap? were you can draw the level instead of duplicating everything, seems way easier and more efficient.
@GameDevKnight
@GameDevKnight 7 ай бұрын
The tile map is in the third episode lol, wanted to go in depth and cover a lot of it, since it's a big concept to grasp and the tilemap changed a lot from godot 3 to 4 so it's for both godot 3 users and new godot users
@HippocritterXD
@HippocritterXD 7 ай бұрын
@@GameDevKnight yeah I realised it when I was at episode three 😅 I forgot to delete the comment. My bad. Was a great tutorial 👍🏻
@rhevoramirez7969
@rhevoramirez7969 5 ай бұрын
thanks
@GameDevKnight
@GameDevKnight 4 ай бұрын
anything for you bromie
@RITO_933
@RITO_933 2 ай бұрын
which version did u use?
@longuemire748
@longuemire748 5 ай бұрын
Thank you for this video. Excuse me but do you have the sprite folder close to the video directly purged of excess?
@GameDevKnight
@GameDevKnight 5 ай бұрын
Yes in the discord below i upload each videos sprite individually, thank you for the comment
@longuemire748
@longuemire748 5 ай бұрын
@@GameDevKnight Thank you :)
@Xerxyz86
@Xerxyz86 5 ай бұрын
I'm already stuck. the asset pack doesnt match what's happening on screen, i only get a tileset which i have to create a tilemap for and it's just not as easy to manipulate as a sprite. what am i doing wrong?
@GameDevKnight
@GameDevKnight 5 ай бұрын
It can be pretty difficult to use, make sure everything is in a proper grid like lets say every sprite in the pack is 16 by 16 and their positions are 0, 16, 32 in the pack, if things aren't lined up they can't be used in a tileset, another thing when it comes to single sprites, you can click on the texture in sprite2D and with the drop down select atlas texture, then you drag your sprite sheet into the atlas, you can then edit the atlas and drag to create a selection on what you want shown, or you can use the settings at the top to type it all in, and when it comes to your player animations you can instead use the AnimatedSprite2D node, if you're still having issues come to the discord and send a screenshot of your asset pack and I'll try figure it out my man
@wint3rxxx
@wint3rxxx 9 ай бұрын
My sprites tend to get jagged egdes when i export them from illustrator even at huge resolution like 500 X 500 px. what am i doing wrong
@GameDevKnight
@GameDevKnight 9 ай бұрын
You can come to the discord and post some screenshots of how they look I personally haven't experienced those problems, the issue could be the default resolution in Godot, I think its something like 1152 x 812 something weird like that, so your 500 x 500 sprite would be taking up over half the screen, a fix should be putting the resolution on 1920 x 1080 in your settings, I do apologize this series is aimed towards pixel art, but you just have to mess around with the resolution settings and the Sprite2D node should have some rendering settings in the inspector, I hope that helps but again you can come to Discord and send me the sprite and I can try figure it out in my own project for you.
@terrencetey1986
@terrencetey1986 8 ай бұрын
Awesome tutorial man, just wondering, im 9:51 in and testing the movement. For whatever reason my character is very jittery/stuttery. My character also cant jump diagonally so easily, or even move left and right easily like yours... I dont know what I'm doing wrong, all i have done is just used the test script template, nothings changed or edited...
@GameDevKnight
@GameDevKnight 8 ай бұрын
hmm that's odd, with the jittery movement when you add a camera node as a child of the player, there will be a setting on the right where you can change the update from process to physics process, the issue was we move with the physics engine and by default the camera updates with the process tick. I'm not too sure about the diagonal movement and other issues, could you maybe come to the discord server and post some screenshots? Also thanks for the comment my man
@terrencetey1986
@terrencetey1986 8 ай бұрын
Hey@@GameDevKnight appreciate you replying! You know what its working properly now. Literally no idea what it was, So I had restarted my pc yesterday to see if that did the trick, same issue. As in when jumping i couldnt press the space bar and left or right direction, its like i was hitting a while. This morning I turned on my machine to try and work on the issue and ran the scene, no issues now, can jump diagonal, run no issues... literally no idea what caused the fault and how it self resolved.
@GameDevKnight
@GameDevKnight 8 ай бұрын
That's pretty funny nice man, some projects can be a bit clunky at the start, there's been a few times where the solution to a problem has just been opening and closing my project 2 or 3 times lol, glad it's working now though brother@@terrencetey1986
@oceanblue24music
@oceanblue24music 5 ай бұрын
I have an issue with this. When I move to the left or right, then the "Idle", Animation isnt working. Its just the player pose sliding on the ground.
@GameDevKnight
@GameDevKnight 5 ай бұрын
hmm, sorry for the late reply I'm sure you've fixed it by now, if you haven't make sure in the animation player the idle animation is set to be repeating, and if you're still having trouble after that just copy paste your entire player code on a reply to this comment and I'll check it for you my friend or come send a screenshot in discord!
@_samuro_
@_samuro_ 8 ай бұрын
where can I find changing texture settings (2:28) in Godot3? There's just no such thing in Godot 3(
@GameDevKnight
@GameDevKnight 7 ай бұрын
Sorry man I'd love to help but I've personally never used godot 3
@_samuro_
@_samuro_ 7 ай бұрын
@@GameDevKnight No problem, thanks for the answer :)
@truenincillo805
@truenincillo805 4 ай бұрын
Please video tutorial swim in tilemap water + area2d in buttom jump (swim+jump)😣
@GameDevKnight
@GameDevKnight 4 ай бұрын
I will in future my friend but sadly not for a while, if you come to discord I can briefly explain to you how to do it
@truenincillo805
@truenincillo805 4 ай бұрын
@@GameDevKnight Hello, I have merged (jump) and (swim) the same button, what should I do so that (swim) is unlimited and (jump) remains the same as I already have it???
@dieselboy.7637
@dieselboy.7637 8 ай бұрын
You didn't show how I import the sprites from the files into godot
@GameDevKnight
@GameDevKnight 7 ай бұрын
You just drag your files into the file explorer in godot, or open the godot project file and drag your files into there
@mo7amed376
@mo7amed376 5 ай бұрын
I hope you send ❤
@jakes-dev1337
@jakes-dev1337 3 ай бұрын
Hidden gem tutorial
@mo7amed376
@mo7amed376 5 ай бұрын
Can you copy a player script for me and send it here ،
@GameDevKnight
@GameDevKnight 5 ай бұрын
Sorry man we are so far in the series now lol, if I had the original episode's script I would've friend
@Woof-Tastic671
@Woof-Tastic671 17 күн бұрын
hey i need it, this error keeps on popping up " res://Scripts/Player/Player.gd:16 - Parse Error: Identifier "sprite" not declared in the current scope." can someone help me?
@djalexander968
@djalexander968 11 ай бұрын
alternatively i suggest for anyone following along this awesome tutorial, if you desire the animatedsprite2d, just do your animations in there per usual, then instead of scale.axis.x = -1 for flipping to the leftside do "animatedsprite2D_Var_Name".flip_h = true otherwise it all works the same! thanks a ton gamedev! (for anyone just copy pasting your gonna wanna fix the alternative aswell :P)
@GameDevKnight
@GameDevKnight 11 ай бұрын
That is a nice tip man, I didn't know that's a thing in Godot thank you
@djalexander968
@djalexander968 11 ай бұрын
@@GameDevKnight i did find out in hindsight, that your method is ideal for the future tutorial episodes, but ive already made the animations so im stubhorn :P, im sure theres a use somewhere out there though
@GameDevKnight
@GameDevKnight 11 ай бұрын
@@djalexander968 there def's is man
@magenta_juice8166
@magenta_juice8166 10 ай бұрын
Yes. You can add only this line in code: if direction: sprite.flip_h = direction < 0 This work as True or False.
@djalexander968
@djalexander968 10 ай бұрын
@@magenta_juice8166 yeah i tend to leave integers specifically for any type of variable that isn't going to be a true false, i try to set my variables to something that can be easily understood, and set them "relevantly" so if i have to flip something and im only ever going to need it to be flipped one way or another, that's literally a binary, true or false, but if I have something like, when falling, do a fall animation, but when rising complete the jump animation, and when ever on ground, stop and idle, that's the times it becomes appropriate to use those integers, because then you can use -1,0,1 and even more if you wanted to add more stuff later, but at least you know you do not have a binary system there, now don't get me wrong will it come in handy sometimes? sure and use it when you can but A im a noob, lmao, and B most others seem to be as well in this particular field at least lmao but hey I'm not gonna knock condition-less programming, shit fascinates me mainly the whole integer thing is only relevant to conditional statements anyhow so lol
@krystiankrysti1396
@krystiankrysti1396 3 ай бұрын
no way to drag and drop multiple png frames into animation player and auto keyframe them by doing this ? this is so overdue
Player Animations - Godot 4 Platformer Tutorial- Part 2
5:37
GameDevKnight
Рет қаралды 7 М.
When Jax'S Love For Pomni Is Prevented By Pomni'S Door 😂️
00:26
Stupid Barry Find Mellstroy in Escape From Prison Challenge
00:29
Garri Creative
Рет қаралды 4,2 МЛН
They RUINED Everything! 😢
00:31
Carter Sharer
Рет қаралды 24 МЛН
10+2 AWESOME ADDONS for GODOT 4
8:36
MrElipteach
Рет қаралды 120 М.
Fixing blurry sprite 2D/3D in Godot 4
4:45
NnekArt
Рет қаралды 334
How To Make a 2D Platformer with AnimationTree in Godot
15:19
NovemberDev
Рет қаралды 49 М.
Checkpoints, Spikes and Coins! - Godot 4 Platformer Tutorial - part 4
25:33
Вселенная и Специальная теория относительности.
3:51:36
ЗЛОЙ АНАЛИТИК ВСЕЛЕННОЙ.
Рет қаралды 7 МЛН
I made a game using Godot for the first time
7:35
shawcat
Рет қаралды 1 МЛН
When Jax'S Love For Pomni Is Prevented By Pomni'S Door 😂️
00:26