Hi! I'm Unain! I make videos about game engines. On my channel, you'll find tutorials, tips and tricks, and occasionally news about game engine releases. Remember to subscribe!
I'm having issues with the movement and jump animation overriding each other. They work separately however when I use both the jump animation overrides the movement. So the jump animation works but the movement doesn't. I used print to try to debug and it is reading that its in run or idle but the animations do not play. I think this is a great concept and I think this is a high value tutorial. I'm just stuck trying to figure this out. Any help would be appreciated. I am fairly new to this but have some understanding.
Best tutorial I've seen so far. Clean code with class for each feature. Not a total mess in the player script as we can see in other tutorials. As someone new to Godot but not to coding I'm happy to have found this video. Thanks !
I always thought resource files were a compiled construct for a type of object for the Windows OS. Perhaps it's different for Godot? Regardless, this is a good tutorial, thanks.
Thank you for the video, had trouble finding documentation for it (probably just looking in the wrong places). But this video was exactly what I was looking for. Thank you so much :)
I suppose I understand how they work now. I just am struggling to understand *why* you would use them. Everything shown here does not need a resource to do in any way, and if anything is made more complicated by using them. What is a use case where a resource is the clear option over just extending off of a custom class or using a script template?
From what I understand, it reduces references and dependencies and helps in error tracking. if there is a bug, you can to ognore respurces as they are inert. if however all your variables are stored in scripts, then you jave to reason about them not the best answer. but its the best i can do
If some people struggle to make their actual jumps animated, there is an altercation between the jump animation and the ground animation. To fix this, you have to be more precise when you want that your "ground" animations (running and idle) play. In our case, they play only when the character is on ground, so it will look like something like this : if move_direction != 0 and body.is_on_floor(): sprite.play("Run") elif move_direction == 0 and body.is_on_floor() : sprite.play("Idle_Combat") func handle_jump_animation(is_jumping:bool, is_falling:bool) -> void: if is_jumping: sprite.play("Jump") elif is_falling: sprite.play("Fall")
Thank you, i've watched 4 explanations on Resources, but this one made it the clearest. One thing I'm still struggling to understand is what functions i should contain in a resource vs in the scene script. Still mulling that one over. Ahhh a fellow Unreal dev to Godot!
Hii, I'm a beginner and I've been using your movement tutorials for my very first game, and I actually love them! But for my taste I don't really like how abrupt the falling is in the variable jump height, if there's a way I can make my character reach the max height in just a bit more time and make the falling less sudden and smoother I would really appreciate your help Thank you in advance if you'll answer my question : )
In nested custom resource, is it possible for the child (I'm not sure if I'm using the term correctly) resource to get the property of its parent's property?
If you are saying something like BaseSkillResource -> FireSkillResource -> FireballSkillResource. It should be able to, i haven't tested it but i don't see why it wouldn't. You should be able to test it real quick, by just making a function to print something when called in the grandparent
@@stabbedbyapanda No no no, It's more like Skill resource that has a property called effect (array) that holds another custom resource class called SkillEffect. I wonder if this SkillEffect can access the property of the Skill class where it is in
@@agriasoaks6721 Sorry I can't i'm also learning about resources. You may not be able to communicate between resources with signals either the more i think about it, you will just have to test :/ If it doesn't work my recommendation would be to have a scene that loads your resources and then you can reference them together. (I think) This would act as a manager that handles what you want.
I think that after the tutorial I will probably handle input within the player script and then I will use signals to connect to the other components. Directly referencing the components in the player code is kind of defeating the point of using components IMO. Yes you are breaking your code into smaller pieces, but I think godot would vastly prefer if you used signals to communicate. if I just emit a signal like "player jumped" then all of the components can deal with it from there, without my player needing to do wonder about anything.
That's a really good couple of videos, detailed and well explained, with the right pacing for a newby. Really appreciated! The only thing I don't like is the sudden stop of the y velocity when jump input is released; IMHO it would look nicer if the movement continued with the fall gravity applied, it would look more natural. I'll try to implement it in the project I'm working on... Project that I'm currently refactoring using your modular approach! Keep posting please, that's quality content!
I had the same thought. What I ended up doing was establishing a new variable var is_at_peak: bool = false Then I defined it right under "is_going_up" as is_at_peak = body.velocity.y > -150 and not body.is_on_floor() Then I changed the jump release call to if jump_released and is_going_up and not is_at_peak: Finally, I changed my jump_released_velocity to float = -150 I didn't add the is_at_peak at first, and it made my character do a sort of double-jump if I released at the peak, so adding in that other check tells the game that if you release at the end of the jump, just treat it like a full jump. Probably could be a lot more sophisticated, but it's the first thing I've coded for myself in the game, and seeing it actually work the way I envisioned it was a real spark of motivation, let me tell you.
@@AxelBurned that's a simple but clever way of managing the thing, I was actually thinking of using a jump_complete variable too, and seeing that this approach can work reassures me!
Yeah, so I did ArmA 3 editing before I started messing with Godot, and this is virtually identical to how Bohemia's scripts can be broken into small config modules that are then called to a main config module, keeping you from going through hundreds of lines of code in one big gross config. This is SUPER cool and pleases my OCD. Also, implemented directly from the video with 0 errors. Thanks so much for that.
That's a weird one, you could maybe select a different node in the scene tree. And then select the player node again which should refresh the exported variables on the right. Also make sure the player script is saved.
@@Unain I think I solved it. It happened when I made de Advanced Jump Component and added do the Player. Then two lines got red, the "handle_jump" and handle_animation_jump". I guess something brook and the Nodes disappeared from the inspector. To resolve that I added # in front of the red lines and the Nodes reappeared and I was able to add the ADV Jump Component in the correct Node Box. After that everything was correct! Awesome tutorial!
At 6:37 you assign the gravity component to the player, i CANT for the life of me figure out how you did that. How do you find/open that little "Nodes" option? Help lol!!
That comes from him adding the @export in front of the line " var gravity_component: GravityComponent " and the "Nodes" option comes from the line above it, " @export_subgroup("Nodes") ". Neither of these are mandatory, it's just an easy way of referring to the gravity component. You can achieve the same thing by writing " var gravity_component = $GravityComponent ".
Dont know for you guys, but for me the export variables resets too often and lose its reference, im trying to use export only for debug things or smples stuffs that i can easily redo
Around 7:19 I explain why. We can't preload dynamically created paths, because the program doesn't know on compile time what the string is going to contain :).
Thank you , Really like your way. I'm new on godot , I have a question : so resources can be used for creating all the items in the game and saved in that data container whenever needed we can call or already loaded in game. for example I got different type , textures ,and stats of 50 swords , 50 maces and 50 spears so should I have a 150 different files under weapon_resources ?
A few things to look at: - using a boolean to prevent additional logic from running until your animation is complete - if animationPlayer.is_playing(): return - _on_animation_player_animation_finished signal
really loving this, I hope yoy realease more tutorials. I'm impimenting similar in my game. Where the gravity module is actually attached to each level and is referenced in each entity, keeping them consistant. but also allowing levels to have a single settable custom gravity. Same with input, allowing the player input to easily impact more than one thing at a time (like my mirror deamon, who coppies everything the player does but in reverse) but I dont see the advantage of move, jump and annimate being seperate? I looks nice, but I feel like its of little practical use? Either way, Really loving the video's please do more :)
Excellent tutorial, helped me a lot to understand Resources! - I do have one question. I'm working on a RPG card game, where each card has a name, a description, and an effect as a function. It seems like you cannot save functions inside .tres so I guess the right way to save each card would be a scene each?
You would have one scene that you fill with the information from the card resource. So the texture/description/name you can just get from the resource and load into that scene. For specific card effects I would have a separate node that you can attach to the card which handles the effect. I would recommend checking out: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-iLT6pTluYvw.html who is making a Slay The Spire like game to see how he handles the cards :)
Actually the editor font is default, but I use a Custom Display Scale of 0.9 so it seems smaller. You can set the Custom Display Scale in the Editor Settings. It's under Interface -> Editor -> Custom Display Scale
Hi, I keep getting the error that add_child cannot be called on a null instance when using 2D nodes instead of the 3D versions. Is there any way you could help me with that?
I'm getting a similar error for 2D nodes. For me, it's with the instantiate part. "Cannot call method 'instantiate' on a null value," it says. Never mind. I figured out my issue. I had the @export var for the PackedScene, but I had forgotten to put the desires scene into the editor. So, of course it was a null value, lol
very well put together tutorial. could we have a part 3 delving into slopes? I'm currently struggling to impliment running up verticle walls and on ceilings
I would love for you to do some cool features such as a dash/air dash, double jump, grabbing ledges, wall jumps, and more! This is a GREAT series so far!