Most videos on tweens were underwhelming when i was trying to understand them, either outdated or straight up wrong in some cases, the docs were the only place that was actually explaining them in-depth, so this is very much such a great addition for video tutorials. Great work keep it up!
only thing I'd add is that get_tree() should generally be omitted and Node's create_tween() be used instead. this will automatically bind the tween to the node without the need to explicitly call bind_node(). this is generally desired so that the tween will automatically inherit the bound node's process state and is freed together with the node.
That's a fair point! get_tree.create_tween() could prove more useful for global tweening which is node independent, but otherwise, a node's create_tween() method seems to be the way to go in most cases. Thanks for the insightful comment! 🥜
Tween_callback! Thank you sir. I've been trying to implement a ledge grab/climb mechanic and couldn't figure out how to wait for the tween to finish to move on to other code. I just used a signal when the climb animation finished, but this should work better I think
Is it possible to add a curve to the tween? Right now I have a working tween which is a straight line from Point A to Point B, but is it possible to curve the "travel" from A to B?
There's a really neat trick you can do by using a PathFollow2D. That way, you make the object follow a path, but you control its speed and acceleration through the tween.
I think there's a mistake around 17:30. You set the tween to parallel, but the issue is that it runs the up and down movement at the same time for each child, which ends up ONLY showing the downward movement. I hope if you rewatch it it's clear what's wrong. They don't move up and down, only down at 17:35. Is there a way to make each child parallel, while having the up and down property tweens run sequentially, or would a separate tween be required for each child?
Woah, I think you're actually right! At first I thought that my game just didn't load in time to see the upwards movement. I think that happens because we are affecting the same property (position). If you look at the previous example, at 14:52, you'll notice that both scaling and moving the sprite work at the same time. Right now I can't think of a better solution than simply adding a delay to your down movement tween. For example, you could write: tween.tween_property(child, "position", Vector2.DOWN * 50, 1).set_delay(1). However, I'm not able to test this right now, so please let me know if it works for you :) 🥜
This was bound to be noticed by someone 😅🥜 However, I only change versions when I know for sure that nothing regarding the subject in the video changed between versions, basically saying that the tutorial is up to date. Thanks for pointing it out, though. I'll make sure to also write that in the description.
Awesome video. Thanks for posting. In a future video, could you talk about tweening inside the process/physics process functions? I'm currently using tweens to move a creature to another creature's location while both creatures are already moving. I've only found this to be possible if I tween within the aforementioned functions. If I don't, creature A will move to creature B's old position instead of its current position. While I figured this out for myself, I'm not sure if it's ideal, and it certainly leads to some unintended results if my parameters aren't perfect.
Thanks for the comment! What you're telling me sounds like target seeking or even pathfinding. I actually have a video which makes a fish follow the mouse (so basically, one character following another moving "character" if you consider the mouse a character). Wouldn't something like that work in your case? Anyway, I'll make sure to write it down and think of something in this regard in the future if you don't find a solution. Let me know if this helps you! 🥜
@@cashewolddew I have a main character that moves with WASD. There are three monsters that follow him in formation. There are hordes of enemies that spawn and use navigation agents to find and attack the player. As this is going on, the player's monsters attack enemies that enter their radius. The attack as well as their return to their starting position both use tweens. Thanks for the reply! It's probably hard to conceptualize what I'm doing without a demonstration, but thank you nevertheless. I hope to learn more about how tweens operate in the process/physics process function so that I can better execute on this idea.
@@Crono2448 Maybe it would be a good idea to make a discord server for people in the community who'd want to help each other. I'll think of a way to apply that.
How we can handle multiple tweens, for example, animating slots in a hotbar (mouse entered, mouse exited), when player can move the cursor very fast to trigger many slots at once? I am stuck with this right now as I am tweening positions slight, but the result is not quite good enough... the slots move out their original positions permanently if many tweens are triggering too fast.
By the way, the same not happens to Scale property... i realy don't know what's the catch with Position property... even persisting the original position to ensure the tween correctly, the bug still happens.
Wow! I just solved it! mouse_entered: tween.tween_property(self, "position:y", -50, fade_seconds). mouse_exited: tween.tween_property(self, "position:y", 0, fade_seconds). I guess my fault was using whole position as Vector2, adding and subtracting the values... Anyway, very nice tutorial brow!
Why not just create an animated scene and set the platform to move between the two key positions seamlessly? You can even set the curve for linear movement or so the platforms are slower on take off and landing with a click of a button.
That's a great question. Truth is, there are many ways of achieving the same thing in Godot. However, some functionalities are better at achieving a result than others. There are benefits and downsides to both cases. The AnimationPlayer adds another node to the scene, while a Tween could be created as a one-shot. For simple animations, Tweens are generally easier to configure and parametrize. Try them both and see which best fits your needs! Hope this answers your question! 🥜
Good video but nothing here is new in 4.2 - the title is a bit misleading. In fact you don't even need get_tree() these days. You can just call create_tween().
Hmm, I think you're right. I can see how one could understand that there are some new features for tweens in Godot 4.2. However, my intention was just to specify for which version of Godot this tutorial is, similarly to how I do on most of my other videos. Thanks for letting me know. I'll pay more attention in the future. 🥜
Correct me if I'm wrong, to my understanding get_tree().create_tween is used to make the tween independent of the node and create_tween binds the tween to the node as an alternative to doing get_tree().create_tween().bind_node(self), so there are uses for both cases right ?
@@ChaoszZChannel A tween created with the scene tree will not be tied to the node, meaning that it will keep animating even if the node is freed, but will finish automatically if there's nothing else to be animated. In the other case, you're right, create_tween() called on a node will automatically bind that node to it, which automatically kills the tween when the node is freed. I generally like creating SceneTree tweeners because they can be used to animate more stuff, even if I freed one of the nodes I was animating, but I think this is a very fair point to be made, that there's a difference between these. Thanks a lot for this! 🥜🥜
Most videos on tweens were underwhelming when i was trying to understand them, either outdated or straight up wrong in some cases, the docs were the only place that was actually explaining them in-depth, so this is very much such a great addition for video tutorials. Great work keep it up!
I'm really glad this is on par with your expectations! I'm happy to hear it has been helpful! 🥜
What an absolutely phenomenal video. Was just thinking about how necessary an in depth tweening video is
It's great to hear that! Are there any other topics that you'd like to see covered in depth? 🥜
Thanks for the excellent content, now I can do Tweening!! I thought the Cooler Daniel part was really cool!
Ha ha, I'm happy you enjoyed that! 🥜🥜
This video is actually very helpful. I've finally understood what tweens are used for
this is the best tutorial about tween, you are the best
Know that your the lifeline for godot devs in animation specifically 😂
There is so much you can do with tweens!
only thing I'd add is that get_tree() should generally be omitted and Node's create_tween() be used instead.
this will automatically bind the tween to the node without the need to explicitly call bind_node().
this is generally desired so that the tween will automatically inherit the bound node's process state and is freed together with the node.
That's a fair point! get_tree.create_tween() could prove more useful for global tweening which is node independent, but otherwise, a node's create_tween() method seems to be the way to go in most cases. Thanks for the insightful comment! 🥜
That is so cool. Great work!
Tweens will relax my _process functions!
Thank you for that video, never heard of tweens.
It's never too late. I'm sure they'll help a lot in the future!
extremely well made video, thank you
Please do more tutorials related to godot 🙏
Tween_callback! Thank you sir. I've been trying to implement a ledge grab/climb mechanic and couldn't figure out how to wait for the tween to finish to move on to other code. I just used a signal when the climb animation finished, but this should work better I think
I'd love to hear from you once your game is finished. Hope it turns out great and I'm glad I could help! 🥜
That was very useful! Thanks
Is it possible to add a curve to the tween?
Right now I have a working tween which is a straight line from Point A to Point B, but is it possible to curve the "travel" from A to B?
There's a really neat trick you can do by using a PathFollow2D. That way, you make the object follow a path, but you control its speed and acceleration through the tween.
I think there's a mistake around 17:30. You set the tween to parallel, but the issue is that it runs the up and down movement at the same time for each child, which ends up ONLY showing the downward movement. I hope if you rewatch it it's clear what's wrong. They don't move up and down, only down at 17:35. Is there a way to make each child parallel, while having the up and down property tweens run sequentially, or would a separate tween be required for each child?
Woah, I think you're actually right! At first I thought that my game just didn't load in time to see the upwards movement. I think that happens because we are affecting the same property (position). If you look at the previous example, at 14:52, you'll notice that both scaling and moving the sprite work at the same time. Right now I can't think of a better solution than simply adding a delay to your down movement tween. For example, you could write: tween.tween_property(child, "position", Vector2.DOWN * 50, 1).set_delay(1). However, I'm not able to test this right now, so please let me know if it works for you :) 🥜
@@cashewolddew I came across the solution which is "Tween.chain":
"Used to chain two Tweeners after set_parallel() is called with true"
This was great!
Great tutorial!
Uses Godot 4.2.2. Changes title to Godot 4.3 for views. Naughty boi.
This was bound to be noticed by someone 😅🥜
However, I only change versions when I know for sure that nothing regarding the subject in the video changed between versions, basically saying that the tutorial is up to date.
Thanks for pointing it out, though. I'll make sure to also write that in the description.
Awesome video. Thanks for posting.
In a future video, could you talk about tweening inside the process/physics process functions?
I'm currently using tweens to move a creature to another creature's location while both creatures are already moving. I've only found this to be possible if I tween within the aforementioned functions. If I don't, creature A will move to creature B's old position instead of its current position. While I figured this out for myself, I'm not sure if it's ideal, and it certainly leads to some unintended results if my parameters aren't perfect.
Thanks for the comment!
What you're telling me sounds like target seeking or even pathfinding. I actually have a video which makes a fish follow the mouse (so basically, one character following another moving "character" if you consider the mouse a character).
Wouldn't something like that work in your case?
Anyway, I'll make sure to write it down and think of something in this regard in the future if you don't find a solution.
Let me know if this helps you! 🥜
@@cashewolddew I have a main character that moves with WASD. There are three monsters that follow him in formation. There are hordes of enemies that spawn and use navigation agents to find and attack the player.
As this is going on, the player's monsters attack enemies that enter their radius. The attack as well as their return to their starting position both use tweens.
Thanks for the reply! It's probably hard to conceptualize what I'm doing without a demonstration, but thank you nevertheless.
I hope to learn more about how tweens operate in the process/physics process function so that I can better execute on this idea.
@@Crono2448 Maybe it would be a good idea to make a discord server for people in the community who'd want to help each other. I'll think of a way to apply that.
Thank you
I'm happy it helped!
How we can handle multiple tweens, for example, animating slots in a hotbar (mouse entered, mouse exited), when player can move the cursor very fast to trigger many slots at once? I am stuck with this right now as I am tweening positions slight, but the result is not quite good enough... the slots move out their original positions permanently if many tweens are triggering too fast.
By the way, the same not happens to Scale property... i realy don't know what's the catch with Position property... even persisting the original position to ensure the tween correctly, the bug still happens.
Wow! I just solved it! mouse_entered: tween.tween_property(self, "position:y", -50, fade_seconds). mouse_exited: tween.tween_property(self, "position:y", 0, fade_seconds). I guess my fault was using whole position as Vector2, adding and subtracting the values... Anyway, very nice tutorial brow!
Ha ha! I'm super glad you figured it out 😁 🥜
Excuse me
Could you explain how you performed the action at this specific point in time 5:44 ?
Sure, I did that by pressing Ctrl + /.
If you're on a mac, the shortcut should be Cmd + /
Cool 😎!
Why not just create an animated scene and set the platform to move between the two key positions seamlessly? You can even set the curve for linear movement or so the platforms are slower on take off and landing with a click of a button.
That's a great question. Truth is, there are many ways of achieving the same thing in Godot. However, some functionalities are better at achieving a result than others.
There are benefits and downsides to both cases. The AnimationPlayer adds another node to the scene, while a Tween could be created as a one-shot. For simple animations, Tweens are generally easier to configure and parametrize. Try them both and see which best fits your needs!
Hope this answers your question! 🥜
15:20
5:12
Good video but nothing here is new in 4.2 - the title is a bit misleading. In fact you don't even need get_tree() these days. You can just call create_tween().
Hmm, I think you're right. I can see how one could understand that there are some new features for tweens in Godot 4.2.
However, my intention was just to specify for which version of Godot this tutorial is, similarly to how I do on most of my other videos. Thanks for letting me know. I'll pay more attention in the future. 🥜
Correct me if I'm wrong, to my understanding get_tree().create_tween is used to make the tween independent of the node and create_tween binds the tween to the node as an alternative to doing get_tree().create_tween().bind_node(self), so there are uses for both cases right ?
@@ChaoszZChannel A tween created with the scene tree will not be tied to the node, meaning that it will keep animating even if the node is freed, but will finish automatically if there's nothing else to be animated.
In the other case, you're right, create_tween() called on a node will automatically bind that node to it, which automatically kills the tween when the node is freed.
I generally like creating SceneTree tweeners because they can be used to animate more stuff, even if I freed one of the nodes I was animating, but I think this is a very fair point to be made, that there's a difference between these.
Thanks a lot for this! 🥜🥜