Save Countless Lines of Code With Animations in Godot

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 98

  • @ishdx9374
    @ishdx9374 3 роки тому +218

    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

    • @Fredo22
      @Fredo22 3 роки тому +5

      Fellow deltarune fan

    • @whiplasher1599
      @whiplasher1599 3 роки тому +4

      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
      @ishdx9374 3 роки тому

      @@whiplasher1599 that would block though, it gets more cumbersome if i need more animations running

    • @dugtrioramen
      @dugtrioramen 3 роки тому

      @@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

    • @industrialdonut7681
      @industrialdonut7681 2 роки тому +3

      @@whiplasher1599 that is disgusting

  • @helianthe3457
    @helianthe3457 3 роки тому +97

    YOU CAN DO THIS BY ANIMATION???? This is a game changer ngl. Thank you!

  • @boschlowtxt
    @boschlowtxt 3 роки тому +47

    Me, an animator: Wonderful! Time to make an entire game with just animations

  • @UsaraDark
    @UsaraDark 3 роки тому +48

    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.

    • @igorthelight
      @igorthelight 3 роки тому +7

      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.

  • @BlenderKiel97
    @BlenderKiel97 3 роки тому +93

    Animation system in Godot is crazy! I had no idea it is capable of such things!

    • @Theraot
      @Theraot 3 роки тому +2

      This was there when Godot went open source. It was never news, so it is rarely covered.

    • @BlenderKiel97
      @BlenderKiel97 3 роки тому +2

      I know but man it's much better than I imagined

  • @noxen1402
    @noxen1402 3 роки тому +34

    We can call functions in animations ?! You just changed my coding life! Thanks for all the great videos!

  • @idk-g5o4q
    @idk-g5o4q 3 роки тому +5

    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

  • @crabscrabscrabs
    @crabscrabscrabs 3 роки тому +13

    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.

  • @sterlingsteele1394
    @sterlingsteele1394 3 роки тому

    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.

  • @paulsullivan649
    @paulsullivan649 2 роки тому +1

    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!

  • @jayarrow4274
    @jayarrow4274 Рік тому +2

    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.

  • @peatral
    @peatral 3 роки тому

    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.

  • @chacelow2438
    @chacelow2438 3 роки тому +2

    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.

  • @Speed-TV
    @Speed-TV 2 роки тому +2

    0:01 save of

  • @PedroBrandesitsme
    @PedroBrandesitsme 3 роки тому +1

    Wow, here I’m chocked again about how easy godot is! Thank you

  • @selgesel
    @selgesel 3 роки тому +1

    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!

  • @Kaedric999
    @Kaedric999 3 роки тому +1

    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 :)

  • @idle.observer
    @idle.observer Рік тому

    As always, great video, thank you!

  • @Chevifier
    @Chevifier 3 роки тому +5

    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)

  • @CyberVi7a
    @CyberVi7a 3 роки тому

    Holy hell I had no idea. This is amazing!

  • @bwah9481
    @bwah9481 11 місяців тому

    Such a powerful tool. Thank you

  • @soundrogue4472
    @soundrogue4472 Рік тому +1

    This is cool for those who want to code less; I'll consider this if I want to code less.

  • @frankhuurman3955
    @frankhuurman3955 3 роки тому

    Dang this is a gamechanger, amazing!

  • @elrelster
    @elrelster 3 роки тому

    Mmm this was incredibly insightful, signed up for the free guides. Quality content fellas

  • @datmantj7
    @datmantj7 3 роки тому

    Animations is going to be a extremely huge game changer!

  • @thomasmaier7053
    @thomasmaier7053 3 роки тому

    Nice format, nice and short and useful.

  • @anastasiaklyuch2746
    @anastasiaklyuch2746 3 роки тому +4

    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?

    • @Thomahawk1234
      @Thomahawk1234 3 роки тому +6

      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.

    • @Theraot
      @Theraot 3 роки тому +2

      I'm not sure I understand the problem. However, perhaps the solution is in using remote transform nodes. Try that.

    • @anastasiaklyuch2746
      @anastasiaklyuch2746 3 роки тому +3

      @@Thomahawk1234 z-index can be used in 2D animations? Cool, thanks :)

    • @anastasiaklyuch2746
      @anastasiaklyuch2746 3 роки тому +3

      @@Theraot Thanks, I'll look into that :)

  • @igorthelight
    @igorthelight 3 роки тому

    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 :-)

  • @nerothos
    @nerothos 3 роки тому

    Yeah figuring out I could scroll my entire level by simply using an AnimationPlayer node kinda blew my mind.

  • @nanotross537
    @nanotross537 3 роки тому +3

    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.

    • @Gdquest
      @Gdquest  3 роки тому +4

      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.

  • @soundrogue4472
    @soundrogue4472 Рік тому +1

    0:13 why code less?

    • @cs1045
      @cs1045 4 місяці тому

      Saving space and Simplicity.

    • @soundrogue4472
      @soundrogue4472 4 місяці тому +2

      @@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.

  • @Wuskus
    @Wuskus 3 роки тому

    This is some black magic right here

  • @whoeverofhowevermany
    @whoeverofhowevermany 2 роки тому

    When I'm already 30,000 lines of code in 15 doesn't even feel worth mentioning

  • @alexguy7395
    @alexguy7395 3 роки тому

    This is really cool, time to make an open world mmorpg using the animation player

  • @punkysuen
    @punkysuen 2 роки тому +1

    It is super neat solution.
    But, would it be easier to reuse Animation Player Scenes on other project by code?

  • @zhengistasbolatov8480
    @zhengistasbolatov8480 3 роки тому

    Exactly, my codes lines would be 3-4 times more if I didn't knew about method call track in Animation Player

  • @angulinhiduje6093
    @angulinhiduje6093 2 роки тому +1

    hey @GDQuest, is this still up to date with Godot 4x?

  • @MrEliptik
    @MrEliptik 3 роки тому

    I really need to use the Animation player more!

  • @Sunny_Lapiz
    @Sunny_Lapiz 5 місяців тому

    Thanks a lot

  • @asdaaaaaaaaaaaaaasd
    @asdaaaaaaaaaaaaaasd 3 роки тому

    life changing

  • @simeontodorov9353
    @simeontodorov9353 3 роки тому

    This is so clever!

  • @ChaoticRomanticCavalier
    @ChaoticRomanticCavalier 2 місяці тому

    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?

  • @definite_d
    @definite_d 3 роки тому

    Well, I wasn't surprised; the website does say EVERYTHING can be animated.

  • @winsomegaming2549
    @winsomegaming2549 3 роки тому +1

    Animation looks more work than coding really

  • @industrialdonut7681
    @industrialdonut7681 2 роки тому

    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

  • @AxZelAnimations30
    @AxZelAnimations30 Рік тому

    Okay so.....
    Is this, like, the equivalent of Animation Events in Unity? If so then this is basically what I need.

    • @wiktorwektor123
      @wiktorwektor123 Рік тому

      I don't know about Unity, but AnimationPlayer in Godot can animate any property of any node.

    • @AxZelAnimations30
      @AxZelAnimations30 Рік тому

      @@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.

  • @NexusBaum
    @NexusBaum Рік тому

    super useful for meelee combat 🤔

  • @999dunkins
    @999dunkins Рік тому

    how do you even make 3d animation with it

  • @Pirochiro
    @Pirochiro Рік тому

    Is there not still a slim chance of a call track method being skipped if the frame skips for whatever reason?

    • @Soroosh.S83
      @Soroosh.S83 Рік тому

      Ah hell nah bro 💀
      (In that case you can use delta time I guess which work for low and high PC)

  • @thomasmaier7053
    @thomasmaier7053 3 роки тому

    What the hell? This is spot on, cheers mate!

  • @SpongeRoss
    @SpongeRoss 3 роки тому +1

    How efficient is this in terms of performance compared to GDScript though?

    • @Gdquest
      @Gdquest  3 роки тому +4

      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.

    • @SpongeRoss
      @SpongeRoss 3 роки тому

      @@Gdquest I'm definitely going to implement this in my workflow, thanks!

    • @Gdquest
      @Gdquest  3 роки тому +2

      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.

    • @SpongeRoss
      @SpongeRoss 3 роки тому

      @@Gdquest Thanks again, and congrats on the kickstarter campaign :)

  • @Lilfishowo
    @Lilfishowo 26 днів тому

    Whats the godot version

  • @rentaspoon219
    @rentaspoon219 3 роки тому +1

    Is this better though?

    • @ishdx9374
      @ishdx9374 3 роки тому

      is it not?

    • @Gdquest
      @Gdquest  3 роки тому +2

      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.

  • @Frazer213
    @Frazer213 6 місяців тому

    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.

  • @ferdeboergd256
    @ferdeboergd256 3 роки тому +2

    Really cool and useful! And maybe a bit too fast explanation... 😅

  • @dugtrioramen
    @dugtrioramen 3 роки тому +1

    Too bad animation player isn't good for relative values. So you still have to use tweens and yields for those

  • @realadnoh
    @realadnoh Рік тому

    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

  • @fuzzy-02
    @fuzzy-02 3 роки тому

    *sirens noises*
    WOOOOOOOOOOOOOO....OOOOOOOOOOWWWWOOOOOOOO!
    *lazer beam!*
    pissshoouuwwwwwww
    *NUCLEAR AIR STRIKE!*
    KA-BOOOOOOM!
    ...sorry that beam got into my head lmao

  • @madson-web
    @madson-web 4 місяці тому

    Well, animations ARE code. But ones you can't directly edit

  • @jonathancamarena3117
    @jonathancamarena3117 3 роки тому

    neat

  • @stanislavtkach333
    @stanislavtkach333 3 роки тому +2

    It's harder to debug...

  • @the_RCB_films
    @the_RCB_films 7 місяців тому

    yooo what!?!?!?!

  • @thegameissimple
    @thegameissimple 3 роки тому

    Except there MUST be drawbacks to this, for example performance wise or something.

    • @Gdquest
      @Gdquest  3 роки тому +15

      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++.

    • @sslaxx
      @sslaxx 3 роки тому

      No conditionals (so no if statements) or the like, so functions would be necessary for those.

  • @DarthVader-dm2lb
    @DarthVader-dm2lb 3 роки тому +2

    Well hello there!

  • @StevenRerani
    @StevenRerani 6 місяців тому

    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!

  • @NexusBaum
    @NexusBaum Рік тому

    WTF! If I only understood, what's happening...

  • @B_dev
    @B_dev 3 місяці тому

    respectfully I'd rather just write the code than fuss about with all those menus

  • @EROSNERdesign
    @EROSNERdesign 11 місяців тому

    Buy this guy a coke!

  • @aaush_
    @aaush_ 3 роки тому

    Yo

  • @hungryOrb
    @hungryOrb Рік тому

    It's Godot, like Robot. Nevertheless, great video!

  • @soundrogue4472
    @soundrogue4472 11 місяців тому

    I do not consider this simpler; it's frustrating to work with.