We're always hungry for more Godot tricks, so feed us!
@DevJeremi2 жыл бұрын
you didn't mention any tricks that I wrote about on your discord :(
@PlayWithFurcifer2 жыл бұрын
@@DevJeremi Stuff can easily slip through the cracks! Where have you posted them?
@disguisedpuppy2 жыл бұрын
@@PlayWithFurcifer can i say sus?
@patrickseeber81152 жыл бұрын
Maybe I'm doing it wrong but I like to use add_to_group(X) and get_tree().get_nodes_in_group(X) to globally register nodes. That way I can call specific nodes without having to know where there are placed in the scene. I prefer this over NodePath export variables. Wanna show only the current menu? Hide all other nodes in the "Menu" group and show the current one. A custom key binding menu? Just get the nodes in group "Action_KeyBind_(youraction)" because you set them up to hold the captured input events for that action. Then simply replace the inputEvents in the InputMap.
@jeffvenancius2 жыл бұрын
I'd just tested this one: As it's usually done in react, you can make a statement like this in GDScript: var foo = true foo and print("if foo is true I'll be printed!")
@herorobb2 жыл бұрын
The bitwise enums idea is brilliant. Also being able to copy and paste bitmasks on tilesets is wonderful.
@PlayWithFurcifer2 жыл бұрын
:)
@MasterofBlubb2 жыл бұрын
In case you ever need that in C#, add the Flag attribute (those with square bracket) to your enums and give them the proper values (bitshifted 1 is preferred as its more redable). Now you can use HasFlag on your Enum variables
@SmeddyTooBestChannel2 жыл бұрын
the color picker one gives me vibes of when i'd leave something in plain sight in my room and think it's missing until i realized i'd grown so complacent to it being there i didn't even think of it being the thing i was looking for
@PlayWithFurcifer2 жыл бұрын
Exactly!
@Montegasppa2 жыл бұрын
This is the most useful “things we wish we knew earlier” you’ve ever published! Thank you very much!
@PlayWithFurcifer2 жыл бұрын
Thank you :)
@NonUnknownDev2 жыл бұрын
I shared this video with my grandma, she said that will leave unity and start using godot :D thanks guys!
@PlayWithFurcifer2 жыл бұрын
Amazing! I'm sure grannys games will be the best :)
@FloMinicHD Жыл бұрын
I rarely comment on videos but this is great, thank you! Especially that small part alone about using a singleton for signal management made me feel like I finally got the last important piece of knowledge to understand how to properly implement signals :) Had that thought before in my head - just not as properly formulated, so this was really helpful ❤
@Roleplay782 жыл бұрын
Nice one! Keep in mind that the color picker is just local to your machine. It is stored along godot settings and not saved in the project. This means that if you wipe clean your machine, or works on multiple machines (like me), you are out of luck. To solve this problem, and store the palette as a project file, you need the colour palette plugin.
@PlayWithFurcifer2 жыл бұрын
Good to know!
@Artichokeee2 жыл бұрын
Thank you for the nice content lately! Really enjoying it and learning a lot. Hope you keep this up since I feel like this is one of the best if not the best Godot-related Channel out there :D
@PlayWithFurcifer2 жыл бұрын
Awww, thank you! We try our best :)
@bagandtag43912 жыл бұрын
That enum bitwise shit is some big brain stuff
@coreybarnett21582 жыл бұрын
These tips and tricks videos are my favorite! Thanks for putting them together! I'd love to see content about UI controls. I feel like I figured it out eventually but really struggle with sizing them and understanding the size flags.
@PlayWithFurcifer2 жыл бұрын
They can be tricky, we will see what we can do!
@pete2752 жыл бұрын
Groups also work as event busses, without having to define a global. Add everyone to the group, then do "call_group" and everyone on the group gets called
@PlayWithFurcifer2 жыл бұрын
Groups are pretty cool!
@KlausWulfenbach2 жыл бұрын
Notifications are also great for when you need to know if the mouse has left the window.
@PlayWithFurcifer2 жыл бұрын
Good tip!
@SaiponathGames2 жыл бұрын
If you want to have a closing screen like credits after you close the game, then you can use the _notification function to get the NOTIFICATION_WM_QUIT_REQUEST. You need to make sure that Auto Accept Quit to be disabled (thanks Nisovin).
@embyrdev2 жыл бұрын
Please for the love of god don't do this, it's infuriating. Just stick them on the main menu at the bottom of the screen.
@SaiponathGames2 жыл бұрын
@@embyrdev Well.. maybe when the close button is pressed, you might want to close up some resources, or do something, it might be helpful.
@SaiponathGames2 жыл бұрын
@@embyrdev Closing screen is just one example, but this thing could be used in much better ways.
@Theraot2 жыл бұрын
Alright, you are ready for: Resource Based communication! The insight is that when you load a resource from multiple places, you are getting the same instance (yes, even if you changed scenes). This means that one Object can write to it, and others can read it. Furthermore, you can put signals on your resources.
@Turnercore2 жыл бұрын
Yes! I've discovered signals in Resources and resource sharing and it's like a superpower. You can use Resources to easily share data among nodes, or even have them save themselves to disk when they change. You can also define custom setup() functions for your resources so when you do need to create more than one, you can have their defaults or data defined by the input variables. Also setget can be used for some pretty great tricks within custom resources, such as escaping and unescaping when asking the player for input. The only issue I've found so far is saving custom resources inside custom resources doesn't work great.
@hilfazer2 жыл бұрын
Strange, i'm getting 2 different instances of a Resource. How exaclty do i do that Resource based communication? I loaded a Resource and called new() but it looks like it's not the way.
@Theraot2 жыл бұрын
@@hilfazer You called new, of course those are new instances. That suggests to me that what you loaded is the resource class. Your own custom resource class, I presume. But we want to load instances, not the class. Godot knows how to save and load instances of your resource class. The files from would be tres or res files (unless you define a plugin to load or save them as something else). To create those files, you can open the context menu of the secondary click on the FileSystem panel and select "New Resource…", then Godot asks you of what resource class, and you pick your own custom one. Alternatively, from code you can use the save method of the ResourceSaver class to save an instance of your resource class (which you would have created with new, like you did). I don't suggest this workflow resource based communication, but I'm letting you know it can be done. I suggest a good read of the documentation on resource paths, if you want to use ResourceSaver. Once you have your resource file, you can then load them from code with load or preload. Or you can have an export (Resource) var, which shows up in the Inspector panel, you can set your resource file to it. For example by dragging a resource file from the FileSystem to it. Although you will run into some long standing usability issues with custom resources in the Inspector panel. Try the addon "improved resource picker for Godot" by MakovWait, you can get it form Github or from Itch. It makes life somewhat easier. --- Built-in resource classes don't have problems in the Inspector panel. But we want a custom one, so we can define what properties and signals it has, and how it behaves. By the way, load is a shorthand for the load method of the ResourceLoader class. Which I want to mention to avoid misconceptions. And yes, that has some implications, but I'll not go into that rabbit hole in a KZbin comment.
@hilfazer2 жыл бұрын
@@Theraot Thanks for an explanation. I tried that and i got the same instance when using preload() but not when using load().
@Theraot2 жыл бұрын
@@hilfazer Hmm… I believe sometimes load works, I'm not sure about the rules. But yes, preload works for sure.
@rosthouse2 жыл бұрын
Resources can also have signals. If you have two nodes that use the same Resources (let's say a health resource), you can set the health from one node, and the other can listen to a signal 'health_changed'. This makes it extremely convenient to stitch together separate scenes.
@PlayWithFurcifer2 жыл бұрын
Thats cool!
@shmolyneaux2 жыл бұрын
As always, this is a great video! Thanks for making these!
@PlayWithFurcifer2 жыл бұрын
Thank you very much!
@mightymochigames2 жыл бұрын
The event bus is a thing I've been wondering about how to do. Thanks for the tips!
@PlayWithFurcifer2 жыл бұрын
Glad it was helpful! :D
@rocket0072 жыл бұрын
2:25 "like animals". Cracks me up cuz I keep doing it
@Chevifier2 жыл бұрын
That second tip will be a life saver
@digitalman21122 жыл бұрын
Another great one. Thanks!
@PlayWithFurcifer2 жыл бұрын
Glad you liked it :)
@RHGameDev2 жыл бұрын
omg, I was copying and pasting colors like an animal the whole time
@PlayWithFurcifer2 жыл бұрын
🐶🦝🐸🐒🦄
@millerbyte Жыл бұрын
Fantastic, thank you for this!
@NightKawata2 жыл бұрын
this is the best one yet
@belzecue2 жыл бұрын
Double encrypted at 6:39. Can never be too careful.
@ezrawallet2 жыл бұрын
Lmao this is a very under appreciated joke
@john19952 жыл бұрын
That was very helpful video. Nice job guys
@PlayWithFurcifer2 жыл бұрын
Thank you :)
@brunch15722 жыл бұрын
I like the event bus thing a lot.
@PlayWithFurcifer2 жыл бұрын
:)
@question_mark2 жыл бұрын
ohh the anonymous enum thing is so sweet
@staticsteam6362 жыл бұрын
I am lurking within the walls of your home, and am waiting for an opportune time to exact my vengeance upon you, and relieve this world of your existence(sorry for bad english)
@PlayWithFurcifer2 жыл бұрын
uhm, you ok?
@w0nnafight2 жыл бұрын
Yes please kill them, they are annoying. Torture them first though ( feed them their own guts)
@voidboi02 жыл бұрын
You guys are the best
@PlayWithFurcifer2 жыл бұрын
@KekLuck2 жыл бұрын
Thanks!
@gofastutos2 жыл бұрын
Good tricks to accelerate development
@Pulkz2 жыл бұрын
Sehr nice
@thelumberjack88382 жыл бұрын
Amazing
@godev15632 жыл бұрын
"Like animal's" 🤣🤣
@PlayWithFurcifer2 жыл бұрын
🐶🦝🐸🐒🦄
@firasalshouli42222 жыл бұрын
Do godot need a script app? Or you can script from godot it's self?
@PlayWithFurcifer2 жыл бұрын
There is a pretty good integrated script editor (the one we us in the video!)
@hectora.32202 жыл бұрын
very usefull!
@hainguyentrung33582 жыл бұрын
It'd better if you listed the contents in the description menu ( for e.g.: The name of each tip) so viewers can easily access useful tips without going through all of them.
@rocket0072 жыл бұрын
OK my grandmother says she loves it
@darkstrife12 жыл бұрын
OK, how have I never just tried the plus button to save colors -_-
@BlackViperCat_622 жыл бұрын
noice
@PlayWithFurcifer2 жыл бұрын
Thanks!
@Theraot2 жыл бұрын
Alright, do know that yield returns, right? If you are calling a function that yields, using yield, you do something like this: var result = yield(function_call(), "completed") Well, when you yield, the function actually returns a GDScriptFunctionState, and you are connecting to the "completed" signal of it. So, how do signals return? Let me tell you: if the signal has one parameter, it returns the argument you pass when you emit it. Otherwise it returns an array with all the arguments. This also means that when I'm refactoring my code to not use yield, I can instead return a custom object has a completed signal with one parameter, and that way the code that uses yield to call it does not break. Meaning that I can do my refactoring incrementally, instead of all at once.
@maxg51962 жыл бұрын
Im a Godot noob, and my brain isn't big enough yet to fully understand. When you refactor your code to not use yield, what does that look like? Like what's the before line with yield and what's the after refactoring line with yield?
@Theraot2 жыл бұрын
@@maxg5196 I have refactor the function, not just the line. On the replies on the comment where I mention CONNECT_ONESHOT I explain a little of the process.
@johnplainview61182 жыл бұрын
5:15 Tactical Defense Poop ...
@GodotDev2 жыл бұрын
The channel where I share the projects I made with godot engine kzbin.info/door/lPkdVpYamtO31RZnFSJA7A
@nyuh2 жыл бұрын
yoomy eenoom
@errolecleston25482 жыл бұрын
,🧐
@igorigor39602 жыл бұрын
before these series I was using Godot LIKE ANIMAL
@Theraot2 жыл бұрын
By the way, are you using CONNECT_ONESHOT? I have been refactoring my code to use CONNECT_ONESHOT instead of yield. I know, shocking! The issue is that when a Node is freed while it was waiting on yield, when the signal comes it causes a runtime error. But when a Node is freed, all its signal connections are removed. It takes some work to refactor, but it is worth it.
@SaiponathGames2 жыл бұрын
How would you use it? Seems cool to hear!
@Theraot2 жыл бұрын
@@SaiponathGames They are continuations. On the simpler case, you have a function that does something A, then yields and then does something else B. That would become a function that does something A, connects the signals you are yielding on with CONNECT_ONESHOT to another function and returns. Then the other function does the something else B. The other function is the continuation. You, of course would want to pass some extra arguments, which you can do with the binds parameter of connect. In fact, sometimes you don't need a new function, if the new function would be a one line call, you might be able to connect to that directly. It gets more complicated when you call yield in a loop. Again, you have two functions. One main function that connects the signal to the continuation one, but that one connects the signal to itself, making the loop (if you are doing a for, you would pass the index in binds, for example). But first you might need to rotate/unroll some of the instructions of the the loop, so it can start on the yield. That way you can extract a function that does what happens from yield to yield (it would take whatever result from the signal, process it, decide if it has to do another iteration, connect itself, and do whatever triggers it), which would be the continuation function. And the main function has to everything until the first yield (the loop probably becomes an if). You might have the logic for what happens after the loop on the same continuation function (since the function decides if it has to do another iteration, it can also handle the case where it does not have to). Or, you know, have more continuation functions. And, as I mentioned in another comment, you can return an object with a "completed" signal, so the code that used yield to call the function you are refactoring does not have to change. And that allows you to refactor a function at a time instead of all at once. One more thing that I've found useful: use call_deferred on emit_signal. I have found myself declaring that "completed" signal on the same object, then returning self, and emitting it with call_deferred.
@Boildroid2 жыл бұрын
How to make blade mode in godot?
@PlayWithFurcifer2 жыл бұрын
What is that?
@Theraot2 жыл бұрын
You can emit signals of other objects! C'mon! You don't need to add a broadcast method to your signal/event bus. You just need to go EventBus.emit_signal(blahblah)