genius, i always thought there was something i was doing wrong when i had several timers and tons of deltatimes, i didn't know animation players could call functions, awesome stuff
If you were using those timers just to pause your scripts for a little bit you can do the same thing in a single line of code by using the yield function and creating a timer within it
@@ishdx9374 you could just put the yield in a separate function, and that function would yield instead of the main one. But animation player is still better
I've always had some pride when I did animations completely through code, but the fact that you can fine tune the timer is extremely powerful. I messed animation player once in the past, and although a bit tedious to setup, it's so easy to mess with once done so.
About pride when you write your own - that's a common thing for programmers :-) You could still write your own modules in Godot. Or just look at sources so you could know how it works.
this is one of those things that felt like cheating when i first discovered it, i always assumed there was some unspoken reason to not rig things up through the animation player, but i suppose not! makes me feel a lot better about the "jury rigging" i did to make things work.
Omg THANK you for this, I made like 3 whole scenes to just to spawn different effects for the bullet, to keep the sound going, etc, omg ty for this. I am like 2 weeks new to Godot, so this is huge for me.
Wow. Had no idea you could do so much via animations. 100% spending my evening reworking at least 3 different areas of my game to use this technique. Thank you!
It's incredible how powerful animations are in Godot. One drawback, in my opinion, is that the code is less readable when you outsource a lot of logic to animations.
The moment I found this out a year ago (or so) I knew instantly that this is the most powerful feature of godot. Animating function calls, audio, literally every exposed variable, that is just crazy.
Just yesterday I was playing around with this idea and started writing my own simple property animator in GD script. Thinking animations were something that only came prepackaged in 3d models. Thank you so much for making this video. Bonus points, it's concise, you're well spoken and you offer helpful examples! Would be great to see if there's any overhead to this approach vs just coding the transformations? When to use animations/animation controllers vs when it's better to code it into the script.
Oh wow this changes everything. I've always felt that object lifecycles should be tied to the animations, and I've had numerous shower thought sessions thinking over generic solutions but failing to come up with one. Turns out it was right in front of me!
Well I've been mulling over whether to pitch in to the kickstarter and I'll let you know that this video pushed it over the line. Had no idea you could do that stuff, hopefully there's other neat tricks in the course :)
Ive been using this method to animate Shaders for a while now and calling functions for hack and slash type games combo follow up attack system.(i.e have a function that resets a combo attack if the player hasn't pressed attack for the next chain attack)
hmm i have an animation question: I have a 2D skeleton body (to animate a character made of bodyparts) and I want to make two such characters embace in an animation, which means some of limbs of one character go behind the second character and others go on top of him. How can I define such layering of bones between characters?
I'm not sure I understand correctly but I think you're looking for the z-index of your sprites or textures. Unless you're talking about 3D stuff. I'm not very familiar with 3D.
You could also connect Signals in Editor, saving another few lines of code. All of that is still code - but it's under the hood now. But it's more clean that way :-)
Let's say you have a projectile that either splits up after a delay, or that can hit multiple times inside an area as it passes through (like piercing ammo in Monster Hunter). Would this be simpler with code or by making the animation call a function that creates more projectiles? Do animations support conditionals? If not then you'd have to call a function that does the branching logic for you and have that spawn more projectiles.
You don't have conditionals so in that case you may use only code or a mix of animations and code. If the bullet needs to do multiple things on impact, you could use an animation just for the impact. You could also get things like making a single bullet scene with different animations for the different kinds of bullet impacts, allowing you to group them all in one place. From code, you'd just have to play the right animation. But yeah it really works only when you have to do a fixed set of things and it involves time.
@@cs1045 Using animations isn't saving space and maybe it's just because I've done coding most of my life but coding the systems is much more simple and flexible.
Excuse me, I have a question. I made an animation of a weapon attack for my hero, but I came across the fact that the animation is called at the coordinates that I set for the hero in his scene. That is, the animation is not tied to the hero in another scene (and in the hero's scene too), but is tied to specific coordinates, which is inconvenient. Could you tell me a little bit how to use animation player correctly relative to the hero, and not global coordinates? Maybe there's some kind of check mark or something like that?
This is a really cool tip, but what about testing or previewing it in the editor? Like, I don't think the functions get called when you preview the animation in the editor
@@wiktorwektor123 yeah I was able to work into it. It is basically like what AnimationPlayer does in Unity. Only problem is that you cannot DragDrop Sprites in it, which is honestly what I was hoping I can do. Some said there's a plugin for that but I haven't tested it yet.
Certainly much better as it's data running through optimized, compiled C++ code. It's interesting to see some people seem to think code would be faster. Animations still use code under the hood. Note that if the animation calls a function you wrote in GDScript, then it'll likely be the same as calling it in GDScript directly.
As with anything when it comes to performance you should measure the difference. But making the engine do stuff should generally be much faster than using GDScript.
can you have tracks loop while others dont? I have an animation im trying to create, where a character walks up the stairs, so i have the sprite being animated which is about .24 seconds long. the player moving up the stairs takes 2 seconds. so id like to know if there is a way to get the sprite2ds track to loop to avoid having to map out the entire 2 seconds.
Sorry buddy, but I'll steal this information for my unreal development ;) didn't even thought about putting also game logics inside the animation/sequence - but it makes conversation with artist a lot easier for me as a developer I think
*sirens noises* WOOOOOOOOOOOOOO....OOOOOOOOOOWWWWOOOOOOOO! *lazer beam!* pissshoouuwwwwwww *NUCLEAR AIR STRIKE!* KA-BOOOOOOM! ...sorry that beam got into my head lmao
No, it'll offer more performance compared to using GDScript or C# as it processes the data in native code. The whole animation system is written in C++.
I've never clicked on a video so quickly and was immediately disappointed. The suggested video under this one is titled: NEVER CODE WITH ANIMATION PLAYER 😂😂😂 Okay false alarm, just watched the other video. Punctuation and grammar are very important!
genius, i always thought there was something i was doing wrong when i had several timers and tons of deltatimes, i didn't know animation players could call functions, awesome stuff
Fellow deltarune fan
If you were using those timers just to pause your scripts for a little bit you can do the same thing in a single line of code by using the yield function and creating a timer within it
@@whiplasher1599 that would block though, it gets more cumbersome if i need more animations running
@@ishdx9374 you could just put the yield in a separate function, and that function would yield instead of the main one. But animation player is still better
@@whiplasher1599 that is disgusting
YOU CAN DO THIS BY ANIMATION???? This is a game changer ngl. Thank you!
hehe.. a game changer
Me, an animator: Wonderful! Time to make an entire game with just animations
I've always had some pride when I did animations completely through code, but the fact that you can fine tune the timer is extremely powerful. I messed animation player once in the past, and although a bit tedious to setup, it's so easy to mess with once done so.
About pride when you write your own - that's a common thing for programmers :-)
You could still write your own modules in Godot. Or just look at sources so you could know how it works.
Animation system in Godot is crazy! I had no idea it is capable of such things!
This was there when Godot went open source. It was never news, so it is rarely covered.
I know but man it's much better than I imagined
We can call functions in animations ?! You just changed my coding life! Thanks for all the great videos!
I wish I had this video back when i didnt know about animations.
This can dramatically speed up your workflow if you tend to do anything by code
this is one of those things that felt like cheating when i first discovered it, i always assumed there was some unspoken reason to not rig things up through the animation player, but i suppose not! makes me feel a lot better about the "jury rigging" i did to make things work.
Omg THANK you for this, I made like 3 whole scenes to just to spawn different effects for the bullet, to keep the sound going, etc, omg ty for this. I am like 2 weeks new to Godot, so this is huge for me.
Wow. Had no idea you could do so much via animations. 100% spending my evening reworking at least 3 different areas of my game to use this technique. Thank you!
It's incredible how powerful animations are in Godot.
One drawback, in my opinion, is that the code is less readable when you outsource a lot of logic to animations.
The moment I found this out a year ago (or so) I knew instantly that this is the most powerful feature of godot. Animating function calls, audio, literally every exposed variable, that is just crazy.
Just yesterday I was playing around with this idea and started writing my own simple property animator in GD script. Thinking animations were something that only came prepackaged in 3d models. Thank you so much for making this video. Bonus points, it's concise, you're well spoken and you offer helpful examples! Would be great to see if there's any overhead to this approach vs just coding the transformations? When to use animations/animation controllers vs when it's better to code it into the script.
0:01 save of
Wow, here I’m chocked again about how easy godot is! Thank you
Oh wow this changes everything. I've always felt that object lifecycles should be tied to the animations, and I've had numerous shower thought sessions thinking over generic solutions but failing to come up with one. Turns out it was right in front of me!
Well I've been mulling over whether to pitch in to the kickstarter and I'll let you know that this video pushed it over the line. Had no idea you could do that stuff, hopefully there's other neat tricks in the course :)
As always, great video, thank you!
Ive been using this method to animate Shaders for a while now and calling functions for hack and slash type games combo follow up attack system.(i.e have a function that resets a combo attack if the player hasn't pressed attack for the next chain attack)
Holy hell I had no idea. This is amazing!
Such a powerful tool. Thank you
This is cool for those who want to code less; I'll consider this if I want to code less.
Dang this is a gamechanger, amazing!
Mmm this was incredibly insightful, signed up for the free guides. Quality content fellas
Animations is going to be a extremely huge game changer!
Nice format, nice and short and useful.
hmm i have an animation question:
I have a 2D skeleton body (to animate a character made of bodyparts) and I want to make two such characters embace in an animation, which means some of limbs of one character go behind the second character and others go on top of him. How can I define such layering of bones between characters?
I'm not sure I understand correctly but I think you're looking for the z-index of your sprites or textures. Unless you're talking about 3D stuff. I'm not very familiar with 3D.
I'm not sure I understand the problem. However, perhaps the solution is in using remote transform nodes. Try that.
@@Thomahawk1234 z-index can be used in 2D animations? Cool, thanks :)
@@Theraot Thanks, I'll look into that :)
You could also connect Signals in Editor, saving another few lines of code.
All of that is still code - but it's under the hood now. But it's more clean that way :-)
Yeah figuring out I could scroll my entire level by simply using an AnimationPlayer node kinda blew my mind.
Let's say you have a projectile that either splits up after a delay, or that can hit multiple times inside an area as it passes through (like piercing ammo in Monster Hunter). Would this be simpler with code or by making the animation call a function that creates more projectiles?
Do animations support conditionals?
If not then you'd have to call a function that does the branching logic for you and have that spawn more projectiles.
You don't have conditionals so in that case you may use only code or a mix of animations and code. If the bullet needs to do multiple things on impact, you could use an animation just for the impact.
You could also get things like making a single bullet scene with different animations for the different kinds of bullet impacts, allowing you to group them all in one place. From code, you'd just have to play the right animation.
But yeah it really works only when you have to do a fixed set of things and it involves time.
0:13 why code less?
Saving space and Simplicity.
@@cs1045 Using animations isn't saving space and maybe it's just because I've done coding most of my life but coding the systems is much more simple and flexible.
This is some black magic right here
When I'm already 30,000 lines of code in 15 doesn't even feel worth mentioning
This is really cool, time to make an open world mmorpg using the animation player
It is super neat solution.
But, would it be easier to reuse Animation Player Scenes on other project by code?
Exactly, my codes lines would be 3-4 times more if I didn't knew about method call track in Animation Player
hey @GDQuest, is this still up to date with Godot 4x?
I really need to use the Animation player more!
Thanks a lot
life changing
This is so clever!
Excuse me, I have a question. I made an animation of a weapon attack for my hero, but I came across the fact that the animation is called at the coordinates that I set for the hero in his scene. That is, the animation is not tied to the hero in another scene (and in the hero's scene too), but is tied to specific coordinates, which is inconvenient. Could you tell me a little bit how to use animation player correctly relative to the hero, and not global coordinates? Maybe there's some kind of check mark or something like that?
Well, I wasn't surprised; the website does say EVERYTHING can be animated.
Animation looks more work than coding really
This is a really cool tip, but what about testing or previewing it in the editor? Like, I don't think the functions get called when you preview the animation in the editor
Okay so.....
Is this, like, the equivalent of Animation Events in Unity? If so then this is basically what I need.
I don't know about Unity, but AnimationPlayer in Godot can animate any property of any node.
@@wiktorwektor123 yeah I was able to work into it. It is basically like what AnimationPlayer does in Unity.
Only problem is that you cannot DragDrop Sprites in it, which is honestly what I was hoping I can do. Some said there's a plugin for that but I haven't tested it yet.
super useful for meelee combat 🤔
how do you even make 3d animation with it
Is there not still a slim chance of a call track method being skipped if the frame skips for whatever reason?
Ah hell nah bro 💀
(In that case you can use delta time I guess which work for low and high PC)
What the hell? This is spot on, cheers mate!
How efficient is this in terms of performance compared to GDScript though?
Certainly much better as it's data running through optimized, compiled C++ code. It's interesting to see some people seem to think code would be faster. Animations still use code under the hood. Note that if the animation calls a function you wrote in GDScript, then it'll likely be the same as calling it in GDScript directly.
@@Gdquest I'm definitely going to implement this in my workflow, thanks!
As with anything when it comes to performance you should measure the difference. But making the engine do stuff should generally be much faster than using GDScript.
@@Gdquest Thanks again, and congrats on the kickstarter campaign :)
Whats the godot version
Is this better though?
is it not?
Moving code to data generally leads to fewer bugs as you can't make typos there. You can edit timings and whatnot. This has advantages at least.
can you have tracks loop while others dont? I have an animation im trying to create, where a character walks up the stairs, so i have the sprite being animated which is about .24 seconds long. the player moving up the stairs takes 2 seconds. so id like to know if there is a way to get the sprite2ds track to loop to avoid having to map out the entire 2 seconds.
Really cool and useful! And maybe a bit too fast explanation... 😅
Too bad animation player isn't good for relative values. So you still have to use tweens and yields for those
Sorry buddy, but I'll steal this information for my unreal development ;) didn't even thought about putting also game logics inside the animation/sequence - but it makes conversation with artist a lot easier for me as a developer I think
*sirens noises*
WOOOOOOOOOOOOOO....OOOOOOOOOOWWWWOOOOOOOO!
*lazer beam!*
pissshoouuwwwwwww
*NUCLEAR AIR STRIKE!*
KA-BOOOOOOM!
...sorry that beam got into my head lmao
Well, animations ARE code. But ones you can't directly edit
neat
It's harder to debug...
yooo what!?!?!?!
Except there MUST be drawbacks to this, for example performance wise or something.
No, it'll offer more performance compared to using GDScript or C# as it processes the data in native code. The whole animation system is written in C++.
No conditionals (so no if statements) or the like, so functions would be necessary for those.
Well hello there!
I've never clicked on a video so quickly and was immediately disappointed. The suggested video under this one is titled: NEVER CODE WITH ANIMATION PLAYER 😂😂😂
Okay false alarm, just watched the other video. Punctuation and grammar are very important!
WTF! If I only understood, what's happening...
respectfully I'd rather just write the code than fuss about with all those menus
Buy this guy a coke!
Yo
It's Godot, like Robot. Nevertheless, great video!
I do not consider this simpler; it's frustrating to work with.