Godot GameDev QA: Answering YOUR Questions!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] hey what's going on everybody i'm so glad to be back um yeah it's been an interesting few weeks with the go go gym and my girlfriend's gone like kind of going through her finals of this year of medical school right now so i'm really excited to finally be back on stream uh as always i'm going to be trying to listen to the chats did i just close it i think i did because i'm a fool why would i do such a thing yep i did trying to keep the the chat open but uh it's like not very easy to get that but now i can check it out from live here but let's go ahead and do this um i need to go here open link a new tab see it's not it's not a fantastic process um oh no no we go create go live sorry about that don't want to appear as an old all right now i'm going to go ahead and drop this over on my other monitor here and by the bing by the boom we're in here um dev nugget what's going on like the name a little dab nugget okay um yeah so if no one's got any actual questions i'm gonna start diving into some stuff today we're gonna go through my discord first um but i don't think there's any questions in here then run jen's and then i'm gonna hop over to the godot q a and just kind of run through the ones that i think are doable on stream teachable moments stuff like that feel free to ask me anything you want and i'll do my best to answer i'm much better at 2d in fact i know very little to nothing about 3d but a lot of the stuff transcends um what dimension you you game devin so hopefully i'll be able to like help out with a lot of that stuff as well um but yeah let's go ahead and hop into i haven't even opened up godot here in a while but this is cool and very excited if you don't know about the gogodojam it was definitely a very cool uh experience here i made the game solenoid which was an awesome i really loved what i did i'm probably going to continue that game and try to publish it along with the godot gamepad here oh i didn't make a new directory let's do that a new folder and this is going to be q a session 0 6 underscored june 14th 21 just in case okay cool uh and now we're in the right place so that's good all right anyway let's go ahead and hop in here so check out my discord real quick there should be a link to join it in my channel but if not i'll drop it in if anyone's interested um and so yeah this guy had a question about type hinting but is solved and that's also something i wouldn't even recommend doing um this was actually pretty cool so this is something i used in my game uh if we go ahead and i load up so annoyed here i can show you so if we play two things are happening one is like if you can hear the engines they're reacting to how fast you're going and the the sound is changing right um uh and so well i kind of have to play through a lot in order to get to the point where that i want to show you so i guess i'll just quit this right now and show you uh the code here but essentially one thing i'm doing is i'm lurking the pitch scale depending on my velocity which is really really cool and that's how i get that effect but the other thing that you can do is that for me i don't want to figure out the uh listener 2ds or anything like that because there is no listener and the audio stream player 2ds seem to not work very well for me so i just coded in myself by doing this so essentially we just check the distance of the target and then we divide whatever our max radius is by the distance of that target um clamp it between zero and one and then we lurp our volume between a low and a high based upon that value so essentially if they're really close to you it'll be louder and if you're really far away from you it'll be quieter which is just kind of a cool little effect to have in your game but any user now i want to go ahead and actually start answering some questions we'll check in jumping rungen's here if you're not if you don't know who rungen is he's freaking awesome he makes a lot of tutorials as well uh and his discord is popping like people are talking non-stop really nice community um honestly my discord kind of sucks because like people don't really chat this is cool some guy posted something when he had a reaction here i like that um i wonder i hope he interprets that as a good thing uh but rungen's is poppin dude people are posting non-stop lots of people will help you in here lots of really cool azay azagaya is in here he's dope um but yeah anyway so i think there's a help in here we can check that out um malhava prasat great guy um okay nothing we'll hop into here then no one's got anything to say on stream so let's go ahead and start writing or answering some of these which i love get size of children node okay uh someone already answers well controllers have rock size and size but i think you should use the expand size flag instead of trying to manually separation between them okay i want to get the size of all nodes and see how to do that um i have three children in hbox container so i want to put first children on left side second children in the middle and the last one on the right i want to put separation between according to the screen with please tell me um stan's hbox container so i'm actually doing a lot with uh control notes and they're not like the most intuitive thing in godot um but in doing making a lot of stuff i really i'm making a calendar app i'm also making a ghetto gamepad that is like i have to create all these control nodes entirely from code because we have i have to send that over from your computer to your phone and so i have to send that all in like a string format and then we take that string format and build that into a control node but yeah so what this guy is saying you don't want to manually do stuff i was trying to do that but you want to kind of utilize the fact of what hbox containers do so just like because this will be really helpful if anyone's making a main menu or something like that i do want to quickly kind of go over like the basics of containers and size flags because i didn't understand what they were for a little bit so we'll make a user interface here and so this is just going to be a basic control mode and then in this we might have some things for instance like i'll go ahead and add a v box container and if you don't know what a v box container is and then here i'll go ahead and click uh we'll do full rect and then i'm going to shrink this should be there we go so it's like kind of more in the center here and a v box container will automatically sort nodes um based on the child number in order down this thing so we can go ahead and add some labels here and then i'll put like hello uh oh we can't adjust the scale i have fonts in here let's see let's do a new dynamic font just for example porpoises there we go jetbrain mono cool cool and then i can change the size here to like uh times three something a little bigger and we'll go ahead and center these guys cool uh and then i'll go ahead and duplicate this a few times and you can see that automatically what this is doing is spacing these out for you but they're not spacing out all the way to the bottom and what not there's things you can do that so for one thing we can adjust the separation any custom contents here so if you go to the v box container you can this is aligning them at the begin it's aligning them at the center and the end as you'd expect okay we can also do something pretty cool uh by going into the custom constants and changing the separation between the nodes so you can see i can if we set this to zero it's gonna make this as small as possible except this is a hundred it's going to separate them by that amount and if you want them for instance to separate exactly when you resize the screen for instance uh what we do i'm going to delete these labels here we'll grab the first one and you go down to the size flags and we're going to go ahead and select expand on horizontal and vertical and what this will do is make it so that this will expand to fill whatever space that it's put in now if we duplicate this you can see that they're automatically going to sort themselves as evenly as possible throughout the container and i'll go ahead and save this we need to go to qa sessions this is the newest one folder ui explanation okay control cool whatever uh and now if i run the scene uh what should happen yeah you can see that they are resizing to fill up exactly the size of the screen there so i should actually probably go ahead and toss this in there um the link stream there you go cool because i i have a feeling this guy would learn very well but anyway that's why you want to do that um and then also just to be clear here so if we make these um oh and then i know eat and then we go ahead and delete these because he's got three labels and he wants them he wants to separate them like this he actually let's change this you can go to changed hi there we go let's change this to a hbox because that's what he wants to do right again i'll go ahead and make this full wrecked and that's important right is that we make this container full rack we in fact don't even need this control here for doing what we're doing but i typically do it that way um and then we've got these three labels and so he's got yeah he says he's got one he wants on the left one he wants in the middle and the last one on the right so um here you can see that they are sorting by their position in the container so if we move this down here it's going to put it in the center and if we move this label to the bottom it's going to put it on the end so that's how you would do it and then again if we go ahead and run this you can see that if i resize the screen it's going to resize them to be equally distant by whatever separation constant you have put in here so we go here uh custom constants separation we set this to like 20 okay uh you can see that affects it a little bit and the other thing is that now when we run this it's not going it shouldn't let them go yeah so it's going to stop it once we hit that minimum separation it'll stop resizing and stuff like that you can also you can't adjust the scale of things but like let's say if you wanted this to get smaller the letters to get smaller you would have to adjust that manually and then for that you can get a little more complicated stuff i don't really want to get into right now but uh you can go into the control mode thing and go to resize okay and whenever this is resized you can then uh notify the script and then go through all your children and go ahead and change their size uh and the way you would do that is with a simple here let's rip that real quick because it's actually not that complicated so we'll go ahead and go here and we'll connect the resize signal right there uh and then what i'll do here is we'll say on ready var children uh equals get underscore children okay and what this will do is it'll uh give you an array uh of a list of all your children that you can access right so this will return to us an array with these labels um and then what we'll do is we'll say on resized we'll say i don't know something like uh for child in um children and then we could do something like resize them so i don't want to do too too much here but uh so whatever our wreck size is right now let's go to rect 1920 we'll do x right so 1920. so we'll say constant direct well this should be correct size max and this will be underscore x we can just put like x uh now we'll do underscore x and then we'll say that equals 1920. uh and then what we'll do here i guess we could actually calculate this right here is we'll say that var um new underscore size equals our we're going to do our rect for max size x divided by rect underscore size okay just like that so this will divide our max size by our oh we don't do dot x here so we just grab the x value okay so we're gonna divide this let's make this a float too just so we don't have any weird errors um and yeah so this will divide this by our current wreck size so if we add our max rex size right this will return one uh and if we're smaller if this number gets smaller then this number will then get smaller um now there might be some other things you want to do to make this a little more optimized but now we can say for child and children we can say lerp and then we can say child dot i don't know we want to say right here child uh child dot okay it's actually as a teensy bit complicated because we can't adjust the scale because of how these work right so if you adjust the scale from like you can see right here if i it won't let me adjust the scale if i go into here and i change the rec scale for instance to like a little more than that uh it should i think reset that scale when i run the game or something oh it's okay here why didn't that work oh no no oh okay um we'll just do this we'll say if children because this is trying to it's calling this before the game starts which is kind of a pain but uh whatever okay yeah so you can see that if you adjust the scale manually it's not going to let that fly it's going to revert that back so oh and now it's like permafucked up what is that the wrong one yes it is that's why okay cool um so yeah so we want to do is go into here to custom fonts this might be different you could potentially you can't change the size or the scale so you have to find some way you can also put a label within another node and then you can resize it from within there that's another way to do this but for instance here we've got the the font size so what we can do is say child dot set and then we'll say custom custom underscore fonts font i believe it's custom fonts font and then just size yeah custom fonts font size okay and then we're going to set it or i guess to make this a little more clear we'll say uh hmm i suppose we actually don't yeah we can do this here so we can say um var oh no we actually can just reuse the new size we could say new size equals lerp okay remember lerp is a linear interpolation that takes between two values um also i'm getting into like some pretty complex stuff here i don't know if this is what everyone is interested in um what the hell what's going on here i don't think this is working oh i'm so sorry you guys my uh i don't know why but my uh oh my god if i need my help uh my streaming software or whatever not transmitting to youtube or it wasn't showing me so i missed all your comments let's see here oh i could totally do that oh okay yeah oh my god i'm so sorry you guys um yeah let's go ahead and do this uh let's grab the discord link well no i gotta do it this way and then i'll go here invite oh jesus christ my girlfriend is at the door and she has forgotten her keys and that is the sound of a pug just by the bye um so i might have to go grab her right now but uh when we get back uh i'm actually going to put this on hold for right now and then what we'll do is is go ahead and do the what the chat wants to do which is that that glitch effect this will take less than 10 seconds so i apologize for this be back in a second [Music] yeah yeah all right what's going on everybody oh that didn't feel good i like ran down the hallway and um yeah kind of feel a little sick but yeah let's go ahead and go over how you did the glitch effect it looks sick thanks diego okay kind of just quit server link oh yeah so there's the discord server link diego yeah so a vbox container will not by default uh move around any kind of other node other than a control but you can kind of cheat it uh in a way that i found which is to do something like this so we'll do i guess i want to do that in a second huh let's let's hide this one for right now and make a new view block so i can show you what i'm talking about so we'll make a v box container here um and then i'll again put we'll make this full rect okay and here i'm gonna add a control well here i'll show you to illustrate the problem that diego is talking about we add a you said touch screen button right um yeah okay so we'll add the touch screen button and then we should probably add go to the icon png just so we can see so this is our touch screen button as you can see it's not being uh aligned within it because it's not a control node but all you have to do is actually just put a control and then make this a child of that control and then when you move this around here so it should work that now if i do well here let's do this let's paste these in here oh that was working for me before i guess it's not working anymore that's a bummer yeah let's do this let's change the min size here oh this is something i totally forgot to go over if you're doing a control like this you can either set these size flags to expand like this and that will make it so that like that so that will take up as much space as possible um like i did before but you can also just set the recommend size so in this case the icon i think is like 64 or something so we'll make the recommend size and the y 64 here um and then i'll go ahead and move this guy to be in the center like somewhere about in the center and of course go into the transform property and do this but i think that should i thought that should work maybe i'm mistaken yeah that works okay yeah so that's that's how you get around that it's kind of a cheat um so there were but this this you have to position that manually in that control but once you do it's solid right so i put this in the center there we can go here and transform it and like so it's 1920 divided by two oh but minus 32 there we go that's exactly centered um and i just did so 1920s is my screen size and then i subtracted half of the width of the icon which is 64. so 1920 divided by 2 minus 32 is what i just did and yeah i made a to-do list app on my phone and manually stored every xy position would move every object recursively dude i feel you i did the exact same thing in my calendar app that's actually cool that you're doing that because i'm going to be making i'm making a calendar app and then i also want to make a to-do list app to go with it so i want to make it so that when you make it like something on your doodle list it puts it in your calendar i'm also gonna have like you have goals and objectives and stuff like that so you can link those to those things and like you can really kind of organize like your your life right like i'm working this task is working me towards this goal and kind of like keeps that in mind i probably won't publish it but i'm gonna use it for myself um but yeah that's that's like the cheat there that is that's dope that i was able to help you because that makes me feel good but yeah um it's kind of a bummer honestly that touch screen buttons are not uh control notes i i honestly don't quite understand that um i bet you there's probably a uh issue raised in the godot thing for um oh produce nugget dude i i don't know nugget's just like a great uh a great word dev nugget okay now you change the dev nugget i like pro dupe nugget that's a good name um anyway yeah this should definitely be a control note there's probably an issue open on the um doe touch screen button as control proposal let's see okay let's see what they have to say because some guy asked exactly what we're talking about um why because all the nodes are sentence control y substitution use containers use button the main difference between node 2d and control is positioning the same reason why you want to use sprites so text is kneaded the normal mutton should do in touch events i have found that i have to use the touchscreen button um touchscreen is different to control because it does not cap compute compute the input it just activates when you slide the finger that's that's why you want the touchscreen button because you can't on a normal button it doesn't register the slides and some of those interesting behaviors um anyway um yeah i have used those buttons several times oh diego what's going on dev nugget um yeah so like i can actually let's let's uh do this i'll show you something pretty interesting let's delete this okay and then godot code godot gamepad where are you okay and then it should be on the gamepad client there we go there we go i don't know why i get lost in my own project so hard so anyway this is like um i don't know if you've seen this i i i this was kind of blown up like a few months ago on the go reddit and then i've kind of dropped off and i've recently started to work on it again and essentially what this does uh is it is a it's a controller that you can play go it's a controller you can play godot games with so like you literally just open this up on your phone it connects to your computer automatically when you hit the connect button so yeah you don't have to put in an ip address as my point and then you can control any game with your phone as a controller which is i think is really cool but anyway so um i guess this is not the right one i wanted to go to uh punch single loader touchscreen button okay yeah so here's how i did that in the exact same way so here's the control node i made the control node direct size exactly the size of that and then the label is centered in that control so here's here's that button um and so yeah that's how i did that anyway and it's definitely necessary to do it that way but then everything works the way you'd expect it to work um and stuff like that but anyway just thought i'd flex this because i'm gonna start putting out some more content on this soon i basically already have it working but i'm trying to add the ability to put like custom styles and stuff that you make in the editor so the idea is that this is not just going to be a basic game pad but the idea is that you can customize it however you want as the game it's going to be free on the app store eventually as the game developer so like if you just want like you want two thumb sticks you can put two thumbsticks on the controller if you want one thumbstick or one d-pad uh and then you know an a and a b button you can do that you can customize the controller for what you need to your game and then when people connect this will like get the information of what controller you designed and display that for the user um and anyway it's actually like mostly done in terms of basics i want to get in some complex stuff like being able to send custom images over which i already figured out how to do but takes a while to implement and then also it's the other big thing uh oh uh text input so i want to have like you know if you're doing like a text adventure game or even like you know some kind of like a jeopardy game you can have people like tech everyone can join on their phone and then they can like type in their answers and submit them to you um in like a text input format which i think would be cool anyway thanks man um [Music] oh for the yeah i actually i think i'm it's private right now but i don't really care so i will totally open this up if this is what you're talking about let's uh settings change visibility make public you think i want to type that out bro you crazy no i'm gonna paste that uh okay there's very few places where i actually remember my password if i didn't have autopilot autofill i'd be so um okay cool let me drop this so this is for that calendar if you want to check that out i'm actually it's funny because i'm using someone else's some basic calendar classes and then i to get mine working i had to change them quite a bit but like i would be lost without them like really weird functions that return to you the day given some integer and it's like how the hell it's like the weirdest function you've ever seen like just a bunch of random divisions that make no sense but uh work for some reason anyway yeah okay so i want to start um i'm going to start pinning some comments up at the top because i want to make sure i get so i have the glitch effects i'm going to pin this up by diego here um oh yeah and then for for today so what i'll be doing let's go ahead and do get up here and then i want to get the i just close github yes i did why'd i do that i don't know um i'll pop up a qa session i don't know why that scared me it was a little horn i don't know if it got picked up but i'm gonna go ahead and drop this this is the um qa session which i think is in the description but uh these are all the qa sessions from the past and then i'll go ahead and upload the one for today uh and yeah and then you'll be able to do this let's go to qa sessions uh and you can see we've already like got all this stuff in here and it doesn't but i do want to i'll finish this later because i want to get to what people are actually talking about okay and then we have skset heal let's pin your comment uh oh you can only pin one comment at a time okay ik or fk armatures honestly don't really know okay i honestly don't know what that is like what do those stand for that can't be you can't be talking about inverse kinematics um bones are two separate armatures connected through bone constraints on oh you're talking about joints and stuff i honestly i like i don't even use joints um i if that's what you're talking about in terms of animation i don't i just use like other stuff i kind of just use the animation player and move stuff around so i can't help you too much there anyway okay so i want to get to sk sahil so how do you play pause pop up in the middle of screen um i kind of went into that a little yeah i actually did do this already so i'll show you that real quick and then we'll get to going over the glitch effect so qa session so again this is in the github um i think it was this one no laser yi uh was it really three sessions again uh basic player neopolar dumps low time pause menu there we go uh so i think it's in let's see slow time sit test world ah yeah wait pause canvas layer yes okay so the basic idea is like so we've got this test world here uh and we've got this script um so this is the pop-up the pop-up is just simply um oh i guess the pop-up is monitoring for this you accept show pause menu yeah show get tree pause equal true so yeah so essentially uh this is a pop-up that is monitoring itself well i made the it's not using a pop-up it's using a color rect but if it was you would just overwrite the pop-up message uh so essentially when we we do this instead of show you just play pop-up and here you would say hi pop-up or whatever it is so i i manager manager i monitor for input right here in the physics process we hit the accept or whatever you want to put for your button that is the pause button then we do show pause menu which will pop it up and we'll also get tree dot pause equal true and this will pause the game but you want to make sure that i think like where is this it's in there's a material oh no no no no where is it pause mode inherit is it on here then yeah there we go so you want to go into whatever you want to act as your pause scene uh and go down to here in the the inspector in the bottom it's just a pause mode and change this to process um so any i think by default everything is set to inherit and by default the node above your root node is the viewport which is set to just a pause right so everything in the tree will stop moving if you pause except for anything you set to process and then any children of this by default are set to inherit so that way they'll all work as long as you have this guy set to process which is the parent here and all that means is that once we pause the processes of all these nodes and everything like that what will happen is that uh these nodes will still run in those processes but all the other processes will pause but anyway yeah all that code and how this works is all in the description already so go ahead and hop on that and yeah let's get into that glitch effect and then i do eventually want to get into that have you tried 2d that is unable to that is able to customize character how to make customization while minimizing sprites of character by using shader um so if you mean by just coloring um then it would be like using a shader get like rungen has a great little tutorial on doing exactly that whoa dude i always thought the warthog was so cool i hate getting distracted but that's sick okay um jay the kobold okay there we go cool cool uh and then he's got a little tutorial and dude he makes so much freaking content that's insane uh maybe we'll just search shaders yeah here we go this is pro i think this is probably what you want so you can do this um and you can see that you can you can change these things and it'll change different parts of the sprite so he he makes a fantastic tutorial on how to i'll go ahead and link this actually for you if that's what you're talking about if not let me know if there's anything else you want to do because i make um i did i did do some other stuff like that for one of my other games where um i would just i had like a list of um like pre-loaded so i'd say like var images right say equals this and then i'd say like normal and then go preload and then we do the path to some image and then we'd say like uh explosive and we'd say preload and then again the path these need to be strings um what just happened there okay uh and then we would need to pre-load so this would be like a path to an image so we'd say like for instance our icon.png um and then we would do two different ones uh yeah so you'd these obviously two different images but then what you do is like in your ready function you would get like the um image class and then change the image the other way you can do that is using regions or sprite sheets and stuff like that and flip it there's a lot of ways you can do that uh if you want more help on that let me know and i'll hop into that um so let's see i think we're doing all right now i just want to get into doing the glitch effect that i did in um my game solenoid oh i don't actually want to get rid of that tab let's go ahead and hop into solenoid so there are like several glitch effects going on here so i don't know which one but they're all shaders so all the glitch effects in this game are shaders i don't know if you're still here diego uh to specify which one you were talking about but let's go ahead and just open up um here let's do this uh godot code where are you oh it's because i called it the gokudo jam project files and we'll open up the project here okay now so there's one glitch effect is like the fade in fade out effect you can see right there like that um the other glitch effect is uh when i shoot you can see that it kind of more so if you look at the edges here you can see that it is kind of displaying or it's it's a chromatic aberration it's changing the rgb color values and shifting them and so anyway that's one glitch effect uh and they both do they're both two different shaders but they do this differently and i don't want to go too much into the shaders but i will say that they're both linked um right here there's the link to my solenoid game i put all the shaders i use right here so here is the um chromatic aberration shader i actually that's the one for shooting uh and then here where is it the transition glitch effect on goodoshaders.com uh and that is how i did this though mine is different um i i'm not going to make the source code for this public but i will absolutely share that shader if people are really interested um but uh yes let's go where is it i think did i make a scene called transition this time right now yeah i did okay transitioner there we go um so if we go to this it's a colorect we made it full screen uh and then it doesn't matter what the color is if we go down here to material shader and transition i'll go do shader params here there's tons of different parameters we have to mess with here but i'm only going to be messing with the pixel parameter i think the animation player here we can see that it goes um well you won't see anything right now because there's nothing behind it but uh let's see we're moving what is this why is it not saying the name of the property yeah pixel red offset and blue offset okay so we're shifting all of those things we're shifting the pixel and the red and blue offset here um let's go ahead and play that okay um yeah and so like you can just take my word for it that that's how the shader works uh i won't get i honestly don't understand all of it too too much um because i'm not that great with shaders that's why i use this shader but i changed it because his shader did not work for being transitions and using the screen texture so i changed it i know enough about shaders um sorry about this oopsies there we go a little bit of lag okay cool i know enough about shaders that i changed this to work uh on the screen so this is exactly how that works this is a transition i made that's pretty specific but uh yeah i don't know i think eventually i'll probably release this i don't really care i don't really want to make money off of any of my games but i do need to make enough money to pay for hosting the ghetto gamepad on the app store so i know you given you take um yeah and the second i don't make enough money to host it from ads then i have to take it down which is a bummer because i want it to be a resource that other people can use it but i'm not going i'm not going to pay money to to do that i would hopefully the ad revenue generates supports itself and then uh anything extra maybe i'll just donate it to the godot contributors or something like that um anyway yeah very very cool um this is a really cool experience so this is you can see it's 3d and i'm looking at a viewport right here if you look at the mesh instance the mesh instance is tilted um by i think like yeah so negative 20 degrees uh and so that's how i get this is all 2d but it looks when we start here it looks very 3d because we've got this crazy like weird um tilted perspective there anyway um but yeah okay anyway so that's that um and those are the links to those um ew dude thanks yeah i'm glad you uh hopped in if you you want anything else explained if that's all you needed uh that's great but i feel like i didn't get everything so please like feel free like no one's asking anything so i'm happy to dive into anything else you've got i will quickly jump into this real quick again because i want to show how you would do this so because i do this a lot so the alert a linear interpolation will learn between a minimum value and a maximum value by this new size value one through zero or whatever so we want let's see what size do we have these at their 48th so we want the max size to be 48 right and we want the minimum size let's say to be 12. okay and then we want what value we want our new size value here okay okay um yep there we go cool and then you can clamp this if you want sometimes i clamp it because you know we don't want this to get too too small but this will never get bigger well so this should only be between zero and one right uh if this gets really small this will get really small and thus will get towards this number if we're equal to one right meaning that our wrecked max size is equal to our current erect size then we will be at 48. uh if we shrink the screen it will do that so now what we want to do is in here for children and children we want to set this equal to our new size okay so we calculate this only once and then we set it for each of our children and let's see if this works so it does not look like it's working uh let's go ahead and print new size y one oh it's getting bigger that doesn't make sense uh am i done what am i missing because this should be getting smaller right yeah that's getting smaller oh i'm so dumb this needs to be yes the smaller the number on the bottom gets the bigger the overall number we'll get so we need to do this yes we want the this number so that way a little bit of quick math is that you've basically got one number on top one number on bottom this number is inversely proportional and this number is directly proportional so the direct size here is directly proportional to this number now i think this should work um or not not at all maybe that's weird because now if we print new underscore size let's do it let's do it yeah so that is working how i'd expect it to work because right now it's one um so now let's let's do this okay yeah that's odd because this shows that it should be working it's lerping size correctly so it must be in this print new size do that so that's printing 48 now let's print child.get let's snag this okay comma that should be a period chat here ah okay so clearly this is not working this is not grabbing the correct thing oh you know why it's because we want to do this no that's not all right let's see what if that does that work nope this should show me the path but that's not why you're not custom fonts font i spell something wrong here custom fonts font oh we didn't print it okay child.get okay interesting so it's not going to do that but what if i do this dot size there we go okay so now we want to do um is we'll just say we'll change this to a get okay uh and then delete that um and then we'll change this to dot size that should work i don't know why it's not um and then that size equals new underscore size okay and now hopefully yep now that works so now you can see that they shrink as they get closer together and they also get straight so yeah that's how you might do that um and yeah anyway that's just one way you could do that and then obviously you can torque torque uh tweak these as you want you can also set an os uh min size uh i don't know maybe you don't want these to get quite that small anyway that's how you might do that um and yeah so that's that's helpful go ahead and push these changes to github okay so this will be uh v box precise main and push so now that's there uh cool cool zendra how's it going man it's going well i'm having uh the time of my life just hanging out um did the ghetto go go jam went very well uh i thought it was really cool i don't know if everyone here joined or at least was uh even following it but it was it was sweet man um i don't i didn't really try to do well in here i just wanted to get people's feedback and i wanted to challenge myself to finish and try a bunch of new stuff in this time frame but i'm pretty happy with what i got the theme i'm honestly surprised i even did that well actually no i'm not that's about where i expect there's no growth in this game whatsoever so and there's i came in 168 over 178 entries innovation surprised that how how much people didn't like it and the over i guess overall it's fine um gameplay sfx music makes sense design i also think 28 is actually pretty solid there are some pretty good games in this community this time around um especially given that that's like basically four stars um and the music in this game is fantastic because it's by das 88 some music playing right now um dude i think game jams like i'm starting to kind of get over them but i think they're really helpful for doing like what i just did like i'm using them like i'm gonna force myself to have a deadline just to get something done and then now if i liked it and i think the game was fun which i i didn't want to stop working on this when it was over whereas like um my thinking that was definitely true i wanted to quit it um then now i can go and i'm going to develop this into a full game which is going to be cool because it shouldn't be too too hard but this game like people really liked it but by the time i submitted this to the game jam i was like i do not want to touch that game anymore um yeah this game was one i submitted to a game jam and then finished up and now it's ah it might not be my favorite game anymore but it's still it's still a really awesome game i really like really tough but uh first game ever pretty cool um yeah let's go ahead and jump back into the q a here and let's try to answer some more people's questions um yeah exactly pro that's like why it's great it's prototyping and then you can you almost like guarantee that you're gonna get feedback on that so you can know like what you're gonna do and stuff like even like now i've got enough probably followers that like i could ask for feedback and get some and my discord other people's discord stuff like that but when you know i didn't have a youtube channel that was a great way to get feedback how to use an inherited function signature i don't know what that means um how to execute a code until a button is pressed i have a texture button i want to execute this code as long as the button is pressed move left input interesting that's a very interesting way of doing that um yeah i mean that's just essentially i don't think i'm gonna do that because i think that's a little too simple you guys let me know um oh you did what do you think most people think it's too hard but once you eventually get into the the rhythm it's like it's very rewarding um i think i just needed to kind of make it easier in the beginning for people but i don't know bounce and base tile map uh involve call non-existent function bound to facetime i already know the answer to that one why can i access a consonant from another class but not a variable um that should not be correct so what's he doing here i think he might be trying to change because you can only change it of an instance of type string oh yeah so this guy covered it it's because he's trying to set it on a class not an instance of the class that's a problem well that's awesome i'm glad yeah it's it's tough most people complain it's too hard but i i think it's custom audio bus not changing volume hi i don't know what i'm doing wrong but i have a music bus that has a master music and sounds the only master can change the volume and the rest is unchangeable can anyone tell me what i'm doing wrong um set bus volume uh index music zero interesting that should work i think uh let's go ahead and let's go only to the music is set to master when music is set to master yes i have triple checked my um so let's i think this is actually really interesting because a lot of people don't know too much about the audio stream player and audio buses but they're really really handy so um i think i will just go ahead and open solenoid again i have the thing open close this one let's go open solenoid here so if you go down here to the audio tab you've got your different buses right these different things so i've got a master volume sound effects and music you definitely want to have these routed through your master i don't know maybe that's what he's doing otherwise this is not going to work and then i've got a file called music which i think is how i'm mostly controlling no it's in transitioner our transitioner here we go into this um we can see that this is how i'm changing the volume so we've got a change sound effect volume audio server set bus volume auto blah blah blah uh new volume um so that is what he's doing so i'm confused he said obviously we're going to set bus volume audio server dot get plus index sound effects and then he's setting the new value so that should work um but i have i have a music bus that has master music i have a music bus that has master music and sounds yet only master can change its volume the rest is unchangeable um so i don't know here let's let's go ahead and link the stream here going over this on on stream right now okay um and then there's like it's very tough to figure out exactly how long i've been doing this for let's see is there anything i think does okay i've been live for 55 minutes and 29 seconds so uh should be at about five minutes okay cool and then i'll add that answer so if we head back over here so yeah this is exactly what he's doing almost verbatim he's instead of new volume this is just a function that changes that volume he's got just zero here which i could definitely do and that would work um and by the way though you can't it's pretty hard to tween this value so i made this function called change sc volume gave it a uh argument that is the new volume and then all it does is change that and what you can do is you can this is the first time i use this tween.interpolate method you interpolate this method and then we just pass in what we once tweaked from so you know for tweening out i'm sorry in between from like a negative 40 so you can't hear the music to you know this is like a setting i've set so the global remembered setting of what you want your max volume to be um and yeah then it tweens it up to that which is cool but uh so as you can see there's a few things to note that are important about this we've got our three buses here these have to inherit from master i honestly don't even know how you would not but you definitely have to do that that's what you have to do um and then also of course you need to make sure that your sounds themselves are inherited uh uh from the correct one so we go to for instance uh the comp player yeah player scene i've got our thrusters audio uh which is good and you can see down here in the bus i've selected sound effects so that's very important because otherwise obviously it's not going to know that it's a sound effect unless we tell it it is and that's what we're doing right there and then what i'm doing here is i'm doing exactly the code he did i'm grabbing the sound effects bus which is this one and i'm shifting this volume here okay um and yeah that's that is essentially how you do that these need to inherit from master that's all it is that's literally as simple as it is so i don't know uh if you're doing something that's not there uh or is weird but that should be that uh please feel free to drop a question in my discord if you're so confused or you're trying to do something different and i'll get into that so i imagine he's not going to see this until later the discord link is up there in the chat go ahead and hop in there and then go into my discord and then go to questions just drop it here and i'll get back to you as soon as i can and that's for anybody who wants to go ahead and ask me questions there and i'll be happy to answer them you know okay so anyway that is cool i think those omnibuses are super handy for stuff like that because then you can control the first game in black body i actually did it in the most obscene way which was like to every single sound effect in the game would register itself on ready with a global singleton it would then like oh no no i would have like a set of like a big old dictionary of values for each sound effect and what their sound should be uh or their volume level and then on ready each sound effect would have its own script that would go up grab that value and set its own value to that value which is just like insane it works but don't do that um yeah okay for some reason i read moisters oh yeah is there a way to get the monitor's refresh rate in gd script uh probably already answered that one help with implementing a wall jump that could be fun why are you using a canvas layer um for which on here i do am i on okay good i'm on ultra low latency which is what i want um why are you using a canvas layer so the reason i was using a canvas layer there and the reason i do a lot of times is because you can really easily change what layer they're on and so that was a transitioner scene so hopefully i didn't close this just open it right back up um so we go to the transitioner so you can see that it's on a canvas layer and then i put the uh the layer to 100 so this is on the absolute top layer that the player is going to see and that's because this is going to close and stuff like that so that honestly does not matter for the um the audio though uh this just happens i wanted to control the audio from the transitioner so that way when i transition scenes i can you know kind of sync up the visual transition with the audio transition um so that's that's the only reason it if that was your question it has nothing to do with the audio uh only to do with the visuals here because now i know that this will um basically interpolate the whole screen that is honestly something i should have talked about when someone diego asked about the glitch effect it's very important that this is on a layer above everything else because essentially what this does with the shader is it takes all the information of everything on screen that is underneath this layer uh and communicate well actually it doesn't matter that's not true anyway just just do this you when you make a transition you want it to be on the top layer um and then this is a shader that is taking all that information and covering the screen with that information so anyway cool cool um that's that's why i did that um i really should make i feel bad because i want to release that game but yeah um yeah dude they have they have cool um i i was putting like a little bit of reverb on sounds like you can add a reverb effect i haven't figured out how to do that from code because i haven't needed to but for sure like you could make um you know if you walk into a cave in your game you could just go to audioboss sound effects and like apply a reverb effect and it would then sound like your all your sound effects are happening in a cave more or less which i think would just be cool and it's that easy to do that within godot um yeah well honestly one thing i will say is that sound effects in ghido can be a little bit costly um if you're adjusting them often so i kind of ran into that so i had to do some things to optimize it because it was using a considerable amount of processing time um but uh yeah anyway just be aware of that i thought that was interesting with godot okay so this guy already solved this problem okay cool i would like to find onions can i do right uh and how do i write to the depth buffer in a shader nope sorry can't can't help you with that how to interrupt looping animation while allowing it to complete current iteration oh he's using visual scripting oh no you're just using the animation tree okay hello thank you for checking this question uh the project is set up uh in the next way uh i am i'm gonna upload it because you don't get a lot of kind people people just like give me the answer so you deserve that my friend um i'm working on a 2.5 d character controller and i stumbled upon one issue to animate my character i'm using animation node blend tree my goal is to make my character play looping bounce animation when he is moving and stop it otherwise the problem is that when stopping bounce animation emits play time the character ends up in the wrong position above the ground i'd like to allow this animation to finish its current loop and only then stop it um okay so the way i would do this is to actually use let's see to control when to play the bouncing mission i come off my blend property blah blah blah when it's set to one it plays looping bounce blah blah blah so the way you would want to do this is you can set um let's actually again let's go ahead and add this in here um and then i'll go ahead answering this live on stream [Music] and then let's see how long have i been recording here [Music] one hour should be at about one hour okay cool um ah okay am i full-blown the stupid okay there we go cool cool so uh what you can do in the animation player is really handy i guess i'll make a simple kind of animation like that so we'll add a little guy here we'll have a node uh well here i'll change this change type to a sprite uh and then i'll go ahead and add the icon here texture just like that um and then zoom in a little bit okay uh and i'll add an animation uh this is a lot to do to explain something but uh not an animation tree so using animation tree player because that's not good animation node blender no using an animation tree okay cool okay um yeah i think i'm just gonna show one of my old projects because it's actually a very simple solution to um do this what is the project oh it's okay so we go here godot code godot man and go to project files and there's the product okay so here's our man gedomian and you can see that he can run around but you might notice that uh when he is stopping or starting an animation um he like smoothly transitions to running or not running it's not just like all of a sudden he starts uh it slows down and finishes and so there's two ways several ways to do that in the animation tree um which is movement so this is just a blunt space 2d but what you can do is you can change the transitions between things so i think i've got it yeah and here i've got it better so in the shoot transition i want the shoot to finish playing right so what i've done is you can click this this bar right here you can any of these ones that link between and then we can say switch mode and you can change this to at end and so what this will do is make sure that this animation finishes playing before that happens if it's a looping animation i do believe this is triggered each time the loop ends oh yeah and then make sure you check auto advance on um so you can see that like when i shoot here he does the shoot animation and then comes back to the other animation like that right um and so that's because it plays the shoot animation and then waits till it finishes and then auto advances back to um this animation and this animation is just the arm bobbing up and down like this uh that's all this animation does so but shoot we want to do that behavior and then at the end of it we want to go ahead and do that so yeah again you would go into your animation tree here click on the transition between in your case your running animation or your bounce animation and your idle animation you would click on the transition uh and then go over here to the inspector i don't know why i can't speak change the switch mode to at end which means it changes at the end of that animation and then make sure auto advance is on uh thus it will automatically advance to the next animation on that stuff in your case you should switch from your movement to your idle uh if you don't have an idle you should make an idle because this is by far the easiest way to do that um well i don't know if you're doing a looping animation hmm yeah i think this is actually what i just said will work for some people but i don't think will actually work in your case in your case i think you actually do want to do what i did in this so in this one and this has to do with the running so you can see when i run not straight up and down i didn't make those but you can see when i run i do this and then i slow down i go into my idle animation i don't just stop it like kind of gradually slows into that and that's based upon my velocity so what i've done here if we go into this is that this is a blend space 2d or 1d actually this is a blunt space so if you go right click we can add add blend space 1d and then so based upon your velocity uh what this will animate so here is this little thing this represents the vector here in the blend position right and i have made it so that if it is zero you will idle okay if it is greater than zero it will start to or if it is one then you'll be running so um you can change this so that way you can slowly kind of work up to the run animation like that you don't see that um so that's pretty much what you want right is because if you've got the bounds animation you want them to kind of come back into whatever your idle animation is so you can do it in a blend space 2d which is like the big triangle but if it's just i'm moving just between running and stopping then i think this is the move and the way we do this in code is that up here if i go to movement in my movement function we can grab our blend position so animation tree which is this sets parameters movement blend position so that is the path to right here so we can see we can go to here the parameters property then we can go to the movement and then get the blend position which again is just the position of this right uh and then again here we're setting if you right click in this i guess you know you click this and then if you click one of these you can add the animation so i can add the idle and the run animation here um is what i would do there let's go back to that um uh and then so what we're doing here is we're just setting the blend position equal to our current velocity divided by our max velocity right and this this will be always a number between zero and one again because yeah so to quickly go over this again and i did absolute value because we don't want this to be negative only want this to be in a positive scale because you could be running left or right and if you're running left you'll have a negative x velocity so we still want this to be positive because we just want this as like a kind of like a vector value or a magnitude not it doesn't need to be negative or positive anyway um so yeah again we take our max velocity and then we we divide our current velocity by our max velocity so if we are at max velocity this will equal one because you've got max you essentially you are reaching your max velocity divided by your max velocity equals one um and then if you are lower than that for instance if this is zero because you're idling then this will equal zero and this will set our blend position equal to zero meaning that we'll be right here so that's all this is two lines of code and you've got that and uh yeah that's how i would do your case like that i think that's really handy and there's a lot more stuff i'd want to do kind of with stuff like that all right so um that's cool we got that one done let's go ahead and hop into some more of these questions here how to interrupt looping animation get size of children node i think is that the one i answered first yeah okay check this out let's let's reload this page okay how to use inherited function i'm going to look at what this is because he might just not be using an example given that event is an input event mouse button how can i code the signature to allow that type in other words i want the function signature below if input events if input is event month and event is pressed target equals event as input of my dot position pass to look like this below but i can error when i do this target equals event dot position pass interesting in this case event uh input event mouse button is a descendant of input event and has also passed the input function as such huh that is odd that that is not working because i'm pretty sure that's what i do in my thing here but let's check this out so i'm gonna go to godot code and uh if i have lunar bastion on here that would suck if i didn't oh game of thrones that's what it's called project. okay um and then selector selection icon yes very nice very nice okay cool um and then oh wait did i not hmm okay let's do search find files uh underscore input and find where did i use this that's not what it was oh i don't think i used it because i think i was also having the same issue that's so funny or if event is input event key and input and event.press event equals event as input event key last key equals ah bummer okay that's not what we wanted either um oh this is in my uh okay this is in john watson's cool do i have that enable in here no i don't anyway um okay yeah so uh unfortunately that is not going to work for you because you should be able to get the event.position you should be able to do that but i don't know why if i go print event right what scenes that's in huds we want to start the game i should have added this to that other game okay cool um so why can't i do event dot probably global that should work i think that's a bummer that i have to sit through that huh okay that's weird let's go over okay well let's do this because i'm going to make it so say var target equals not triggered very tragic target okay i'll say print target okay and then let's just make sure this works yeah that's totally working um i would probably do global position but uh yeah so let's rip that pump is he using input or unhandled input he's using input but that should not make a difference also he shouldn't be tight hinting uh yeah okay so first off let's do this answering variable stream i should be at an hour 10. minutes okay and then i'll do this i'll say the following is working for me cool let's do this so i think that um yeah okay so i think that his problem is probably so people unnecessarily type things tie painting is great but there's no need to do it so you shouldn't be type hinting these that's probably part of the problem yeah this this should definitely not work it looks like below i get an error when i do this is it is a descendant of and is also passed in the input function as such um here let's go edit so i think i just misunderstood the question but uh you should not type in virtual functions if that is that is what you are okay save changes cool cool cool cool cool cool anyway yeah so i'll go ahead and delete that now but yeah you should not be typing virtual functions type hinting is like nice but absolutely not needed and you know obviously if it's causing a bug you shouldn't be doing it so yeah you definitely should not be tight hinting uh the events in a and this also you shouldn't be tight ending delta you can but there's literally zero points uh in doing so um yeah you should not do that you should just do it this way uh it is pressed event is pressed is fine event.pressed is also fine it is pressed is a function this checks the property they're both doing the exact same thing and uh yeah anyway let's go ahead and quit that and yeah let's let's um move on shall we yahoo hi if the topic isn't too big can you explain how to go about coding a state machine for a player character by yourself uh and how it basically works yeah i would love to do that um as long as you are in the chat you are going to get priority so i'm happy to do that um i guess i'll just start from scratch and just make one so we'll go ahead and we'll add a 2d scene here and add a kinematic body 2d um and then we'll go ahead name this guy player we'll add a collision shape also add a sprite and then as always we're going to add our beautiful icon to that sprite there we go okay um and then i'll set the collision shape to a new square shape this nice and then we'll go ahead and add a script here so i want to save this well here before we do any of this let's go ahead and save this so we'll go back up here a new folder and this will be state machine okay um this is gonna be world ralt world okay save it right there i'm gonna go ahead and add a script to the player here okay um now i i am going to steal some movement code so let's go play here so i don't want to make all this movement code again let's just do that and uh we'll do nice i think we'll be grabbing this we should be good here based on that a few things i want to get rid of so we don't need here we don't need these and we also don't need any of those okay and then this should work so now if i wrote no no don't have acceleration color players ah there we go let's do that okay anyway so that's just basic movement code i've made this a hundred times so i don't just feel like coding it from scratch again um but now if we run this i should be able to move the play around yep like a freaking maniac very excited about that okay um now what we want to do is go ahead and check this out um yeah so so i'm not gonna i'm uncovered with the state machine from scratch but not all the movement um yeah so a state machine so there's a few different data types we're going to use here so i'm going to use enum okay and we'll make a few states so we'll stay constant uh normal normal uh and then we'll make another state and we'll call this we can do this we could say idle we could say normal okay so these are our two states obviously you're probably going to have more than this and after i quickly go over this i'll show you an example of my code where i have a much more complex state machine like this it'll say var state equals so what this does the enum function is essentially this just um creates constant variables that are just equal to numbers so right now we have essentially a variable called idle that equals zero right and then we have a variable called normal that equals one and then what you can do in your physics process here is you can say match uh match uh state okay uh and then we would have things like this would say idle yes we'd say idle right there uh pass and then we'd say movement oh no i made this normal let's make this uh move move uh we want to do movement so i should actually set this to move by default so now if we run this oh this needs to be one more over so now if we run this you can see i move uh and if i want to switch there has to be somewhere that i switch to the idle state right um maybe i don't want this to be idle maybe i want this to be like shooting or something for instance um then you would make that in this code right so like we can say that uh we can make like a timer for instance and then switch and we would do something like i don't know if velocity here we'll check if velocity equals equals vector 2.0 then we will oopsies then we'll just say state equals uh idle okay uh and then in the idle state here's where we would have to determine like what is going to happen in the idle state uh and ideally what you'd want is a maybe another function called idle and then it would detect four movements uh and then what would happen is then when it when it sees that you have an input well let's just go ahead and do that so we'll make like function um idle idle uh and then you would probably have some uh some like you know play this animation do this uh i don't know maybe restart recharging shields whatever you want to do at that point um and then we would have something like this we'd say again we would say i'll do this yeah i'll do this um so first off i want to put this i'll say idle in here okay uh and then essentially what we want to do is that if we detect input from the user um then switch the yeah we can just do this that's fine so we'll do this okay and then all this is just very dirty i'll say um if again i'll just do this so if input vector like this right uh if input vector does not equal zero then what we'll do is we'll say state equals move all right now actually before i do this i would like to do this um so right now you can see i'm pressing my arrow keys and nothing's happening because i'm in the idle state now if i make this for instance like print hello and i run this you'll see in the bottom that it's printing hello because we're in the idle state now again there's nothing if i go ahead and change this to idle uh and then i hear i say well here let's actually just do this right here i'll say print uh state and that'll actually be handy because then we can see here so if i start the game you can see that we are in the idle space because it's printing zero if i start moving it's gonna start printing one if i stop it's gonna start printing zero again um and so essentially all we're doing is we're switching between those states and different things are happening in those different states um and so i think that is that's pretty handy this is again this is not the best way to do that specifically but they're the or i mean um between an idol and a movement state that's not the best but this is this is how i find is a great way to deal with states and then your physics process you just match that state you can also just do this with a bunch of if statements um it's almost the same thing with a match but i think for something like this specifically i like to do it with a match statement uh so again i'm gonna get the the github link for this should be in the description but i'm gonna go ahead and push this it's gonna be state machine uh i'll go ahead and commit that and push that and then i'll go ahead and show you a project i did i've got a lot of things open don't i yeah okay we'll go to this one um and i want to go to hex code jam parry and we'll open up this project i'll show you an example of a more complex um awesome dude i'm glad i could help if you've got any questions please go ahead and just ask some more i'm happy to help with anything also you know subscribe and then hop i'll be trying to do these weekly so you can hop on here you know maybe you don't have any questions now figure out one hop on here ask me another question i love doing it so yeah um but anyway so i want to go over to the this is oh that's the fake player oh i called him perry oh oh okay cool so now if we go into this script you can see i've got this is a pretty complex script um and then we've got here we've got our enum with our states so i've got normal parry good dream hit and dead so all these different states that you can be in right um and uh again we have we have made it an export bar but you can just think of this as a normal bar and i'm setting it to uh normal just like ignore ignore this right this doesn't even doesn't matter um it is just different from mine because as you can see in the startup screen i have him right here and i want if i load the game you'll see that he's dead at the bottom of the screen because that's how i want it to be and then i made it if you play the game then he like pops up like that sorry i guess i'm stuck in my eye anyway um that is why that is like that but you can see that we've got tons of different ways of changing these so you can see in our physics process i'm doing that exact same thing i'm saying match state normal parry good dream hit dead right very handy uh and in these states i'm doing many different things so in normal we're allowing the player to attack move or parry uh and we also are making sure that we set uh this good room state to false okay uh then you can see in our movement function if oh this should be included there anyway uh there should be something in movement that will switch it wall jump movement paused let's see state is it not i know i guess there's nothing in oh i think yeah i have a function called animate that kind of does that but uh again all we're doing is changing the state it's actually more clear on something like that um that's animate where is it good dream functions parry functions there we go okay so if impact if input is action just press ui parry right so pairing is like just you know deflecting a bullet right then we switch our state to the parry state so again the function parry is being called a normal because you have the option to essentially block a move in the enormous that you're running around you could block but if you do block then i want i want this to happen uh we're gonna put i guess here i'm not doing anything but this would switch to this state right and that's kind of the point is i don't want the player to be able to move or attack anymore so we switched to the parry state um and that's what you can see i've done right here uh is that we switch the state to parry and we also start a timer um right here um how did i do this i think i did do this with the timer but anyway eventually once the parry is oh it's an animation yeah so the the animation triggers and calls this function um but yeah so anyway so we start parrying and we switch our stake to pair so that way it can't move then once we finish that parry animation then we play this and we switch our state back to normal so that's how you do that depending on what state you you want to do you know you have to change states based on something but it actually makes a lot of sense right like if you are idling uh that means like oh my velocity is zero then you should just take to idle like that's that's as simple as it gets and yeah it just depends on your case if you've got any specific example i'd be happy to work through that but yeah that's basically how you do that and this is now on github and i just pushed it link is in the description ocnikos what's going on hey have you tried one of these state machine plugins i wonder how they compared to manually uh making one as you did i haven't tried so i don't i have not now let's take a look state machines extended state machine hierarchical finite state machine um i don't know what a finite state machine is honestly let's google that a finite state machine or funny uh automation uh is a mathematical model of computation it is an abstract machine that can be in exactly one of a finite state oh so that's exactly what we just made combinational logic finite state machine push down automation uh cool okay well anyway that's what that is um rice's this is really interesting this one looks the coolest so i'll go ahead and check that one out that's how i do things um this time based on notes and methods very interesting i i mean i definitely prefer to make things myself first of all let's also get rid of uh well let's comment this um i want to see one of some pictures i don't want to extend it today whoa what the heck what this plugin is kind of a state charge you should read me to learn how to use it okay whoa dude this does not this looks less friendly than mine to me but i guess it depends on you i think this is what a lot of people are doing i definitely prefer it to prefer to do things my way i i'm not even gonna that just looks more difficult but if you are a visual learner i'd imagine or like you like using um something oh this is cool actually kadotic that's cool yeah i mean i typically do do state machines for animations huh yeah i'd love to thank you my girlfriend's the best everybody i promise she's real too oh yeah um but you know for animations you kind of have to use a state machine and then there's much more i've actually had a lot of fun animating like i showed you the godot man earlier and of course i deleted it or exited out of it at least um kadoman project files project. um well actually so yeah that this is actually a really simple state machine so let's actually open up perry again perry nice okay and now let's go to perry if you check out perry here and i go to my animation tree you can see that i've got a pretty complex looking animation tree here and i actually did not understand that much about it um as i kind of wish i did so for instance like i'm manually switching between all of these but you really don't have to right so like um for instance like falling should automatically transition to running like well you might need to do some things like hit the ground and then if that is true then change but something like hit for instance like when i get hit i want to go ahead and play this animation and then when i'm done i want to transition to whatever is is next in the in the normal so yeah so like for instance we can have this transition to that and then we could have like yeah we could have this all on like okay if my y velocity is this then i want to be falling uh if my x velocity is this then i want to be running you know stuff like that handy but yeah anyway and then you can so you can click on these and change the transition mode to immediate sync fn anyway so this is like the closest i would get to a state machine in any of my games um but yeah there you go there you go i've made that a lot too in enemies too like i'll have you know following uh searching like some guy might just be wandering or what it called patrolling so patrol chasing attacking you know stuff like that uh really helpful for ais i use it more for ai's than players to be honest but yeah i think it's pretty cool yeah i like i don't really understand the difference between a state machine and behavior tree are you listening to me google hey while finite state machines are used for general visual programming behavior trees have a few advantages over it they provide lots of flexibility they're powerful easy to make changes to i guess i just don't understand nope no i just want to search i mean i'd imagine it does something like that but then has line of sight chase player rotate to face bb entry bt chase player move to um yeah i mean this is essentially the same thing as a state machine that's why like i don't understand why they're trying to say there's so much difference like i have each one trigger different events in the state like if we're if we have line of sight so hey i think if we have line of sight do this if not do this like that's basically a state machine um yeah i mean yeah it's the same way a state machine you just a behavior tree is really just a deep state machine you've got this then here you have states within this and then you can choose that so i don't know that's basically how i do it is like that so i'll have like chasing player and then one if you're in the chasing player you're basically having another state machine within that state machine saying you know if your charging timers time out that shoot otherwise just chase like that's kind of how i do that anyway yeah that that's all i can say about that and that's all i have to say about that okay um yeah let's go ahead and check this out gonna hop back in here need help with pathfinding in 3d space sorry i can't help you there um why can i access a constant another class but on a variable let's scroll down a little bit uh get screenshot of the game how to paint a time up i've actually never done it but there is like you can do i think there's like something up here you can use and then in code you can do that so let's just click on that because it looks like someone answered this question answer take screenshot bar hold clear mode you block.clear mode uh interesting whoa i don't think it's that complicated i think there's a much easier way to do that but uh anyway cool i'm gonna make a tile map with different colors of chat for anyone interested there is a great video from gdc2017 about these techniques for ai development the video is called ai arborist thank you nicos um yeah it's yeah i mean i would absolutely go over that if anyone's interested as well but um yeah i know it's something that like makes that part of programming makes a lot of sense the state machines is the easy part for me the hard part is like actually coding the behavior in the state machines but that's just me is there any visual spit i'll do the dishes babe editor one note giving two different instance ids spicy spicy black tea oh actually yeah give me one of those in one of the cardamoms sorry okay hopefully someone could point me in the right direction towards someone sex with a thousand since you have class name player just use if body is player as your conditional i wonder if i should no because yeah i mean there's there's ways to do this but i think making global anyway so a lot of in my scripts you'll see me do like global.player equals self on the player and then all the others can access it that way but uh yeah because this is handy when it's something the class name player you can get the general script and stuff like that thanks acting that goes i'm i'm probably on the way out here unless things pick up but you know it's cool i wish oh very nice oh it looks so good i got i got a new mug it's beautiful i think i think it's great um anyway um yeah okay so that works he's explained that um if anyone's got any questions again please drop them i'd much rather answer those let's go and read it too because reddit is cool um really nice people on um but okay we'll search this by help animation tree thank you thank you uh behaving inconsistently occasionally won't change the sprite interesting need a bit of help hello i need to know we're trying to create a n fnf mod launcher using the engine that is not good for this handling animation and i'm a bit stumped to what the best practice is to handle my animations with my player yeah yep he handled that one shader applies to all objects of this type um okay so this is something i've covered uh several times before but essentially you want to go go to the inspector tab go to um material and change resource all right there you go and that's it so um if you go for something like this and we go to uh material uh i don't have a material on this one but you can go for instance it should be here too no it's not gonna let me let's see shader this is what we want right there here we go okay so if we go to one of these you can go why is it saying that oh cause it's a scene sprite there we go okay so in material here you can go to so yeah this should be go to material material resource material resource local to scene okay uh scene okay and make sure each instance is different copy and paste will not will prevent this from working okay anyway so what i'm trying to say there and i don't know if i communicated well was that if you go in here and i um command c command v and just copy and paste one of these guys it's not the the logo to scene thing no longer works so this is done with we've got two shaders if i go over one then that one highlights with the shader the shader is applied to that one now if i duplicate one of these guys uh and then i gotta move it so i go this now what happens is that oh it's that's weird before that that was not working if i duplicated it it did not seem to work for me here we go c v i'm gonna do that let's see maybe they fix this and oh yeah they changed that in good o3 okay so they fixed that so that was a bug i thought they did that on purpose but um yeah so now it still works what i'm saying but now you don't actually have to be aware of the aware of the caveat which is that if you duplicate or command paste the node it won't work because um it was identifying them as the exact same node and now they fixed that and i guess i'm in the most recent good 3.3 um i think this is 3.3 right where does it why does it not say yeah 3.3.2 stable um yeah so that's fine okay perfecto yeah all right the tom green arcade i have an enemy who drops ammo on death for the user let's go ahead and unpin diego's comment okay oh our oh i missed two big old questions all right let's see what you guys got i guess i technically i'll read them both and whatever's easier i'll do first if i set a variable to true to start a timer the timer starts over and over again every frame and never finishes is there a way around it or maybe there's a better way to do it i have an enemy who drops ammo on death for the user to detect it and pick up would you do an area 2d on the player to detect it when um it enters the ammo sprite or a signal on the ammo um well i already actually here let's check this out i've made a pickups i think here we go coins um so this is the github link to this is in the description and you can go check this out yourself and i'll show you exactly how i did it here um uh no no no where's the world coin test world okay cool so in this game um you can see that these are coins supposedly they're good to o tokens and you get near them they they fly towards the player but you can see that this also implements exactly what you're talking about like how would we get the player to pick them up so the here's the coin it's a it's itself a scene right uh it has it itself is an area2d it's got another area 2d we've got two area 2ds on it this one yeah this one is this detection area you can ignore in your case because this is just to uh determine if the if the player's in this area then this area will move towards the player right this has nothing to do with collecting it this area has everything to do with collecting it uh so on here i've connected a area entered signal you so i guess the answer to your question is you need to do both because when this enters this is this smaller area here um i don't know if you can see that flicking there but essentially when this enters the player what we want to happen is two things we want the player to know that they have picked up the coin and we also want the coin to know that it has been picked up by the player so that we connect the area entered or body entered signal depending on what your player is and then on here in my case i'm just going to cue it free that's all i got to do and then gary entered oh we connected both signals i guess oh yeah okay okay yeah um and then for the player what we do is we do the same thing we have an area and then we connect the signal here should be connected maybe i didn't coin collection area but essentially oh yeah i never connected that up but then you would do that you would do so we know that the coin is an area and we go here and we just connect area entered and then we would do on area entered i guess i'll just do that on area entered what we'll do is then we'll say like for instance like you can add that whatever that is to your inventory so you can say coin and um in this case i know they're coins so i could say like for instance i could make like a var money um equals zero and then i could say like money plus equals one one but what you might also want to do right is like if each item that you're having the player pick up is a different item you could then say something like uh you can make a variable here like variable target identity so variable um item equals and it could be a string like i don't know gun right so let's say this is a gun and then what we could do here is then say uh area dot get underscore uh item item okay uh and then this will return to you so if we go here we say print okay something like that uh now what we do is if we run this and i oopsies gotta go into this one if we run this and then pick these up you can see that they pick they print out what they are so that way we can get that from the coin here uh and we can change that what we want so we could make this for instance oh no longer gun but now it's a you know a fish yeah i was gonna do a fishing rod but yeah it's a fish uh and then now these will all be fish um and so that way you can have you can have one coin be a fish uh let's actually let's do this let's make this in export var export var item and then we'll go here to the world and then we can go to some of these variables and say okay i want this one to be a gun uh and then i want point four over here to be a uh coffee right uh and then now we can say like okay i picked up a gun a fish a coffee and then another fish anyway so that's that's one way you might go about doing that um and yeah this code i should probably get rid of those right now uh it's important to note that for instance i just deleted the the variable item here oopsies and now if i try to pick them up they're not going to have that variable so it's going to say null okay that's the good thing about get is that it does it won't break your game it'll just say null but sometimes what you want to do is say like for instance you can say if uh if area dot get item then print the item and now it won't print anything unless we set one of those guys to the item right uh so yeah anyway that's that's how you might go about doing something like that and then we'll go to player i'll disconnect that okay cool cool that's how you do that thanks for thanks for uh hopping in thanks for asking me a question um then i'll get to ochnikos in a second but i want to answer if i start to be able to true to start a timer the timer starts over and over again every frame and never finishes uh is there any way around it or maybe there is a better way to do it so i'd imagine what you're doing is setting you're trying to start the timer in the physics process uh which is inherently a problem and uh well here so that is you definitely do want to use the timer note but the problem here is that you've got something so let's go ahead and add this i'll add a timer uh and then i'll go ahead and save this let's go back up here create folder this will be timer in physics physics process okay uh and this will be timer [Music] thing okay cool i'll add a script here um and then so i'll do on ready bar timer equals timer and then we'll do your function underscore physics process delta pass okay now i also want to go into the timer and connect the timer timeout signal right there just like that okay cool so what i'd imagine you are doing is trying to start the timer by doing timer dot start and even if it's not in physics process maybe you're doing this in like like every time the the player you know finishes his run cycle animation you want to start the timer and it's not finishing the way you would do this is make something called a flag so we would say var timer underscore started well you can also there's a few ways you can do this so let's go ahead and open up the documentation so if you go to up here to the search help and we search timer we can look at the node here um so we have is stopped right and this returns if it's stopped or not so you can say here we can say um if timer dot is underscore stopped stopped okay then timer.start and here we'll say print uh timeout okay uh and then we can do this and you can see that this should work and so it'll start printing out timeout timeout timeout timeout right because this is going to be true only when the timer has timed out so it will only start it then you can likewise do something like this you can say if not timer is stopped and then we'll get the opposite effect this will never work right um so yeah you can only this makes it so you can only reset the timer if it is stopped so we actually don't need a flag in this case but a lot of times what i'll do for instance when i make shooting games what i'll do is i'll say like for instance we'll have like input so we'll say if input dot is uh action just pressed shoot right and then we'll say and can underscore shoot okay pass and then i'll define can shoot here so this will be a var can underscore shoot equals true okay then what we'll do is we'll say timer dot start ah there we go okay and then i'll say to simulate shooting i'll say print shooting okay and then what we'll also do here is we'll then say can shoot can underscore shoot equals false and then here we'll say can underscore shoot equals true okay so essentially what we've done here now is that when we if we press the shoot button um and we can shoot then we shoot uh then we won't be able to shoot again until the timer times out so that's how you might make like a fire rate right um so i'll do this and then i'll oh that's because we want to change the timer to be one shot for this to work but um so i can shoot but then i'm pressing the spacebar over and over again and i can only shoot until it times out shoot okay shoot and then see it only prints there so uh that's one way you can make a kind of a fire rate and that's one way you might do that with the the timer like that anyway yes i'll push this to github real quick say timer okay commit and push to order okay cool and let's go ahead and see what ochnikos was going to say i have a follow-up question similar to the uh the tom green archive on a huge world i have many different things with static bodies areas to detect player interactivity should i just use all static bodies areas at all times or is there a built-in technique you don't have to handle spawning the physical nodes uh oh awesome i'm glad that helped you um no of to handle spawning the physical nodes when and only the player is near for whatever reason when i hear can shoot i imagine the player shooting a can nice i feel that um there so i actually haven't dived into this too much but there is absolutely so the way i did it the first time i ever try to do something like that is uh i have something i should probably upload this to the ghetto um like asset library but i have something called a doorway node i don't know if it's in no i didn't put it in here but essentially the doorway note is an area that like it's got two areas like this and it can tell you if you've gone through the doorway in which direction on which side of the door where you are so you could do that and you could divide up your level into chunks and you can say that if you pass this doorway meaning that you're in this area then load everything in this area but if you pass the doorway on this then only load everything in this area but that is a lot of work and there apparently someone mentioned me this on reddit there's like i think it's in resources process priority script visibility material there is something that basically does this built in but i haven't messed with it yet um let me see if i can find it real quick um i don't know oh yeah i made these logos everyone hates them which i thought was i don't like this one at all someone else just said try making one that's not a face uh and then i thought these i don't i thought this was just fun i don't like this one but i think this one's sick um okay cool uh and then i want to see because someone asked this question [Music] okay let's see um i'm trying to figure out what i could search to find it i think it was like large or maybe levels where i don't even see that second one okay i hate that i can't find this okay so it's above that entry hexago james jam an introduced course for non-coders oh interesting um i know this is not riveting but i would really like to find this oh here we go you can use okay imagine your chunk parent is a noted you can use instance placeholder to have the position there we go i guess it's a placeholder okay uh let's try this place okay so i guess that's not a thing let's check the suit the object placeholder for the root note of a pack scene turning on the option lotus placeholder for an instant scene in the editor causes it to be replaced by an instance placeholder when running the game this makes it possible to delay actually loading a scene until calling replaced by instance this is useful to avoid larging load scenes all at once by loading parts of it selectively the instance placeholder does not have a transform this causes any child nodes to be positioned relative to the viewport from point zero zero rather than their parent class as displayed in the editor replacing the placeholder with a scene with a transform will transform children relatively to their parent again okay um so it looks like this is a like something we can look up but if i instance placeholder i don't understand like where this is though like i don't understand how to access this but yeah this is this is like what i would want to get into but i just can't figure out exactly how to use it so script processor priority pause mode you'd think it would be right here under node editor description um huh hmm not thread save use object call deferred interesting like why can't i choose this and then say okay i want this one no no let's let's just try godot instance placeholder not look at the documentation huh you can select instance scenes in your scene tree and convert them to instance placeholders that remain visible in your scene uh within the editor but which will initially not be loaded until but still present in the scene tree at runtime then when you run your load data method you can just call replace by instance on each node that has the annual true fight okay so this is this is still better it's still very similar to what i was doing before but yeah i mean maybe you can look into this um oh like click that would make a lot of sense i don't see it apparent duplicate move down ah okay yeah i mean i don't know i don't know how much i want to get into that right now but um i would definitely look into this this is this is definitely like where you would want to look at that right and then i can show you my doorway script if anyone's interested i think it's probably the most efficient way to go about that so okay the old or the godot 3.3.1 or just 3.3 broke this so i hope that everything still works but um so here's a doorway right here's that scene so if we go here and so what it is it's got two areas i've also labeled them so you know uh and then i've made a bunch of custom signals here so doorway used um and then it tells you the direction or it's yeah and then the uh so area one area two it tells you one entered one uh exited two enter two exited and you can get very very complex with this uh and so essentially it'll tell you on which side that you entered so for instance we can do on blah blah where's it where's doorway used so yeah on on each one exited and then yeah so it tells you if you exit the second doorway this is the direction on which you've exited and it only lets those know if you've so if you've walked in and then walk back out it won't accidentally send the signal uh and it'll tell you which way you're going to do this i should probably just like link this huh yeah let's do that let's do it let's just let's do it um no where is it not perry should be is it this one is this mecca i think it is scenes functional scenes doorway cool okay and i'm just gonna post that in uh well here let's code uh is this tutorial projects nope where is this testing there we go okay and then i'll just add qa sessions this one folder doorway okay and then i'll paste this in there now this should be let's quit this uh oh but i'll show you how i'm using it real quick in the in the game so we run this okay so you can see that if i run through this doorway then it knows that i'm on this and i want it to load up this house and then if i'm on the side i wanted to hide that house i definitely want to get working on this game more especially now that i know all the things i know i can optimize it a lot more i can make things look a lot better anyway so anyway yeah that's i'll push it to github right now say doorway okay um yeah and then that'll be right in there so you can look at it it's going here open that text dependencies it's broken okay uh and open anyway there we go and then there there that is now it's all it's probably let's do that oh look at that i would love if it would do that wait what i wanted to ah oh there we go oh no it worked okay cool wonderful okay cool uh and then yeah so this is all that is if you go through this area it tells you which area you left if you just go to the doorway used signal i think that's pretty handy um yeah i thought it was still um oh it's perfect oh my gosh it's like cinnamon clove and cardamom tea it's my it's my type of feet my type of feed okay cool yeah please everybody like go ahead and drop some questions buster bobo what's going on hi there i have a question about signals between two nodes which are being instance spawned by scene to code what is the best practice to do it so far i have attached script in the beginning of a scene hey so you can connect and disconnect signals from any kind of or from any node right so if i'm spawning nodes in somewhere we can go ahead and connect those signals so i guess i'll actually make a little thing here that does this so we'll make a new scene make a 2d scene um call this world okay and i'll go ahead and save this go up say signals from code okay and we'll hit save and then uh yeah i need to find something that can spawn here that has signals but uh so i'll make so you you shouldn't have to add a script to the node you're spawning because you should be able to do that from here so for instance like um let's go find a player there's a here's a good one or not you can't operate those from a foreign scene copy paste it there okay now we've got this player scene um and what notes is oh there's a mouse that's dope i didn't that's so sick i don't think this was there until 3.3 but now on collision objects you can do mouse entered miles exited that is so nice it makes me want to start working on my tower defense game again because i had to do a lot of sketchy stuff to work around not being able to do that by adding control notes to everything anyway uh sorry about that okay so draw blah blah blah so the way we do this like let's say i want to spawn a bunch of enemies in here um color so this was one where i made an enemy some enemies let's open that up make sure this is gonna work okay cool uh so now i'm gonna make something to spawn those guys so i'll make bar enemy underscore uh tscn equals preload preload enemy okay uh then i'll make a quick little function here say function spawn enemy okay um and then we'll do var enemy underscore i ims equals enemy scene dot instance and then we'll say add child enemy so we can connect any signal from the enemy here uh in this code to whichever node we have access to so i have a question about blah blah blah which are instance spawned to a scene by code what is the best practice to do so so now we would do you could make it from that enemy if you wanted like for instance like if i've got something i want to connect it to here so i've got a enemy here and i'll make a new signal so we'll say signal signal enemy underscore died okay i'll put this at the bottom here uh and then when it's dead we'll say emit underscore signal uh signal uh enemy died okay uh oh i don't have no way to kill these enemies right now yeah i need to make a way to kill these guys real quick i have okay on body area entered and then i think it's dying if body dot collision layer is not equal to your body dot modulate equals self.modulate we'll see right now but i'm going to go here say function ready underscore ready and then we'll do spawn enemy okay and then here what we'll do is we'll do connect connect uh and then we'll say now you could do this several ways we could connect one of our signals to it or you could say enemy instance um enemy underscore ins dot connect and now this should give us some of the codes from there so we want to see enemy underscore died okay self and then here we would say like i don't know on enemy underscore died okay um and i'll quickly just make that function here okay uh and then we'll say print enemy cool right uh and so that's how i do that right is like we've got this function we create an instance uh and then so from we're we're doing this from this script right from the world script um and it is spawning the enemy so thus we can do enemy instance.connect that to that and if you have access to the player you can again you can just change this to be um like that that note so for instance if i want to grab whatever that is i can say um you know get children dot get node player or we can just do this like uh we can do this player right and then we can connect this signal to that one to this guy if he if he has uh if he has this function then that will work right all right uh and so yeah that's essentially how you do this you shouldn't have to add that because you can connect it from other nodes when should you use load versus preload essentially you should always try and use preload the only time i would not use well here let's really quickly let me finish this to wrap it all up here um right now what's going to happen is when the enemy dies uh it's going to be connected to this so even though the enemy is going to be spawned like this it will be connected here and you can see i didn't there's nothing in the enemy script that connects the signal it just emits the signal right and you can do that right with like a built-in timer or something like that you can spawn a new timer and just like connect that signal um you know connect like timer.new timer.connect signal timeout to self uh and then on some function and you can do it that way and that will work right now i don't think i can kill the enemy let's do collision okay let's see if this oh and then i want to move the player over here can i kill him uh no it's not gonna let me kill him i don't i don't know how to make that guy die but uh anyway yeah it's connected i guess you just have to take my word for it but um i don't really want to figure that out right now because that's not the point this will work this will connect that signal yeah okay once you use load versus preload you should basically like i said you should always use preload when you can preload essentially what preload does um and i explained this in my last scene instancing video um is that uh so this is the path right this tells you where this file is it tells you nothing about the file whatsoever it just says like oh this is at this location in your file system preload or load goes to that and loads it into or creates basically an instance from that whatever file is at that location preload what this does is literally like right now in the editor before you even run your game what this has done is it's gone to this path and it's created an object in virtual space or at least it has now all the information about whatever is at that path when you use load you don't do that until it is run time so if for most things it's not going to make a massive difference but for some things it is very important or very beneficial to use preload because you don't have to spend any kind of processing resources loading a script at runtime the only time i would recommend loading a script at runtime rather than using preload is when you're changing uh what's actually in that file which is a pretty complex thing uh that you probably won't do in for the majority of people like i'm doing it in kind of a weird obscure way where um i am allowing in the editor i'm making an app it's pretty meta but uh here i'll just show you go to godot code so right here so the reason i say it's meta so for instance right here this is the pause button and so when i click load button style so right now i make the button style and i can change it and then right here i would click load button style and then i'd go in here and choose one now i've i've coded all of this i coded this this thing the delete button if you click this it does you know it pulls up this directory here and stuff like that and um so when i go down here where is it cut button style boxes if i click this this is going to load uh this information at runtime because until runtime we don't know which one we want to load you will always know i guess that's that's actually i guess the the easiest heuristic if you know which file you're going to load before the game starts you should use a preload if you don't know which file you want loaded until the game starts then use a load but a lot of times if i have like three files then i'll just preload all those files rather than load which one i want at runtime so yeah it's up to you there's a lot of different ways to do that but basically use preload whenever possible and you really only want to use load if you don't know like for instance exactly what's happening here is that like i might change the style so i might go and change the the border thickness to be like three on all these guys and if i do something like that then um you know changing the self to player but i can't figure it out follow up to that the enemy i have instancing the item is queued free so i would need to connect it to the player instead of self okay let's check this out [Music] okay follow up to that the enemy i have incising the item is cued free so i would need to connect it to the player instead of self what would i change in the connect to do this i'm assuming uh changing the self to player but can't figure it out yeah so um you need to have access to the player somehow so the way i typically do this is i make a global script this and it has a var player 2d or var player right uh and then it equals null you can just ignore that um so var player equals null and then what i do is i go into group yeah it says you need a global script otherwise this won't work project project settings auto load and then you just here it is globals we go and we select um whatever script it is that says global's here and then click add and uh because i've added this script this means that i can access the script from any script in the game so in the ready function of the player what i'll do is say funk underscore ready uh globals globals why is that not working there we go player equals self okay uh and now uh any enemy or whatever can access the player um from the from the script there so the way you would do that is um where am i doing this right here so essentially this let's see how do i explain this so this whatever this is is the the function that is receiving the signal this whatever is dot connect is what is sending the signal so in this in this case the enemy is sending the enemy died signal to self and then this is the function on self so in your case yeah you would change in this case this would be player so i might guess i would do globals dot player right uh and then i would have to make sure that that exists in player right that we have a function function this exists in player right otherwise it won't work okay um but yeah yeah that's it but yeah again so this is the heuristic is like this is what it's this is the sender this is the receiver always um and then you but you can you can connect them in any script you want right but you know and it doesn't matter so you can the the receiver can connect the signal from the sender and the sender can connect the signal from the receiver the sender can connect the its own signal to a receiver like any possible combination but if the enemy instance is the one emitting the signal enemy died it must be here and that must be there and then south was that anyway yeah um yeah awesome dude i hope that helps again yeah the the only complicated part i feel like well one is understanding that basic hierarchy but two is that it's you need to have access to the player but after that it's that's the pretty i don't know i think signals seem really complicated at least they did to me when i started out but now they just seem so intuitive i don't know i hopefully when i teach them they make more sense than the people who taught me because i felt very lost okay all right um if anyone else has got some questions i'll happily take those i think i'm gonna answer probably try and answer one more question uh and then i might be all ready to to herod for today stop on asha after it's played the gravity of the game accumulates by definition that's how gravity works quick question when you have many say 10 buttons do you prefer to connect each of their signals to a controller or to do something with the code to avoid manual clicking okay do you want a question when you have many 10 buttons do you prefer to connect each of their signals to a controller or do i don't i don't understand what you mean [Music] um so like like you mean you would uh like manually be clicking mouse entered max exited all those things is that what you're talking about [Music] oh i think i think i see what you're saying yes um so let me actually open up one of my other projects here this is a calendar app i'm making so what i'll actually do here is um is this the right i don't think it's the right scene but you can see if i open this up uh we've got the calendar here uh and a lot of these things have signals connected to them like so for instance actually every single one of these horizontal lines you can see right here there's no horizontal lines when i run the game there's horizontal lines every single one of these horizontal lines has a script and uh it is being connected uh when it's spawned so i think we need to go to calendar they're not event wait is this the right one oh this is the right one okay so i think it's no it's um this one so yeah i would prefer to do it in code so you can see that here i think where am i doing it where am i connecting connecting that but uh i'm on scene oh maybe oh yeah i used to do it that way but anyway yeah i would i if i've got 10 buttons you can go through and connect a signal by doing like for instance like this you can do like you know four you can do four uh child in get underscore children children um and then you could check like you know if child if a child is uh control if child is control um then we can say like uh child dot connect i don't yeah focus entered whatever to yourself and i i definitely would prefer to do it that way and i have in the past but there are also things where i do just do it manually um because it's just i don't know it it depends like there's one thing on here going here i connected all these signals manually i think the rights or did i connect is it this one where is it this one this one i kind of swore i connected like a bunch of signals manually somewhere oh it was this but i i changed it but yeah i mean like so for this for instance i did do it manually but uh yeah if you've got a lot i would definitely do it in code i think that's the better way to do it um yeah but i do i do all the time do a lot of manual clicking and my shortcut is that like i'll just do i'll click this and then double hit the enter button the other thing great about doing it that way is like these are all these all have different names obviously and like let's say i want all of them to affect the same like you know function here like refresh sizing let's say then i can it's much much easier to do that in code but yeah yeah yeah yep yep yep i hate doing it by hand when you've got more than just like one thing to do but you know it is what it is um yeah i want to check if there's anything really interesting um oh oh i'm gonna answer those are all oh yes okay how would i put a slight delay on camera 2d uh no if kids can code answered that then he's better well let's see i saw a previous question about how to make the camera follow the player but with a delay giving a bit of a bouncy look the answer was to use an interpolated camera but that's 3d i haven't found yeah i mean i would not do that i would do certainly um he actually did put a very complex answer and what you can do is just simply if we add for instance a camera 2d here uh you can just go to so drag center yes then we'll put uh drag margin drag margin h enabled yes and yes uh and then i think we should be able to go like view the camera view show helpers zoom process mode limits there we go and then we can set the limits so let's say left to 100 oh what am i tripping oh maybe it's not limits offset oh there we go drag margin that's what we want why can't i see the drag margin you should be able to see it i don't know why i can't huh it's odd but anyway yeah so now uh i want to go oh now it's chasing me oh because i set myself as global player oh but this is not that that's a big reason why and this is also the enemy which we don't want do this do this let's add a camera node here okay uh and then i want that on the player we'll put current to on uh drag margin drag margin h enabled that enabled and i again i don't i still don't know why that's not happening but yeah but now you can see that the the camera is not would be nice if i had but the camera is only moving once i like come past a certain amount now the way you would solve exactly what you're talking about is i would do for instance you turn smoothing on where is it smoothing uh click enabled right and then we can set these all to zero uh and then now when we move it it'll trail behind it and then kind of like bounce you know like like that you'll see yeah so that's probably the best way to do that yeah yeah i think that's probably the best way um so i'm gonna go ahead and post that right here if this is about but you can set drag enabled on a camera 2d smoothing on like i did my other ones answer this live on stream okay should be what time is it should be around two hour 25 minutes or so okay cool all right so quickly to you can't really see what's going on here so i want to just kind of add some sprites and we'll add icon [Applause] duplicate these guys a few of these guys so you can see what the heck's going on here just for some visual reference and then i kind of want to pause this so you can see that um it like it snaps so it passes me and then it snaps up like whatever you'd want so it's kind of a little bouncy and what you can do here is uh go to the camera and we can change the speed of this to be slower or faster so if we set it to one see what happens that it like slowly comes over to me right so it's automatically lerping we can also set this to be like double the speed and much faster so you can do something like this so then like it's like much more snappy and then you can play around with stuff like this like you can make the margins go like this and then you know it'll only start like that then it's barely like you even have smoothing on at that point but uh yeah uh so it depends what you want you can also uh change the speed during code so you can make this like kind of change exponentially lots of different ways that you can mess around with that uh this is probably what i think you're looking for is something like that and i prefer to do this a lot so essentially the margin is zero so the second you start moving it's gonna start trying to smooth over to your position and it bounces over to you like that which i think is a nice effect anyway um yeah okay cool cool yeah um let's see i think i think i might be done yeah you know i'll finish my tea and that'll be done can you add collisions to a line draw a line function yes but you will have to make your own question replace it with a line is lines did not have close on their own a solid question um i am going to open up one of my old projects here i know it's solenoid so it is it's the gogudo jam project files oh that's weird i don't know why i put the doorway area in there project okay and then laser um [Music] okay okay so essentially what it is is the laser right here it will find the point that is a across from here like if this collides here it'll draw the line to there and then it will make a collision shape that extends from here to wherever that point is uh on the line so yeah our call point is where it's a good collision point um okay shape extents dot x let's have a look rotation okay uh call shape dot shape equals shape and then shape equals uh okay so this is all we need to do for that so i'll go ahead and do this and then i'll post that in here yes here is a called snippet that i use to basically do that except with a raycast and line 2d node uh principle is the same okay let's do this and then i need to modify the code a little bit so our collision point equals recap okay collision the lasers up once um okay and then just to make this less confusing so this should be there we go oh no okay cool no why is it not there we go okay all right cool anyway that's how you do that all right i know how to enable camera draw margins on screen you have to go to camera properties editor and just check what you need ah let's check that out camera properties sticker mode oh there we go oh there we go thank you oh but yeah that's why because it was dragged perfect i don't know why that's not enabled by the fault anyway yes that's handy dope thanks man i actually did know that but i totally forgot so that's good to know um yeah okay okay maybe one more i'm not addicted how to use and an if statement i don't know i feel like that's confusing me because you're like yeah i made a 3d first person game which i can't even do right now but then you're like i also don't understand how if statements work that's like i'm like i have no idea where your skill level lies um but yeah i get screenshot of game i would paint a tile map different colors and visual spatial material like the visual shader editor uh how does godot work i'm actually interested let's see actually does the calculations between frames how does it keep track interesting um okay conclusions to a line change raw modulation in code draw function problem i want to pick up all item does that mean every single item must have code in it how can i override a method of a variable a method of a variable german box which i don't know i'm running out of steam here um if you guys have any questions i might be done because i'm not seeing any great ones that seem fun to answer share the common materials imported models where is it where is it going template download file to uh how do i enable and disable the interpolate camera by using a button where's the mouse coordinates input in visual scripting how do i check if a process is true uh don't use visual scripting how to check if a process is true my question is probably most recent one on the list shader versus facial material if you fancy having a crack at it oh yeah i don't know anything about 3d honestly um material reaction is spatial code but shader engine yeah i don't think i could help you with that honestly sorry man i don't know that much about shaders i've i barely can write my own i usually just modify ones i get from the godot shaders so i probably can't help you too much on in that regard let's see what you have here i've got a 3d model with many meshes which i originally imported materials i decided to change them to mesh instances avoid starting from scratch i made a new model for the mesh in question export from blender well the relevant mentions the new mesh has three surface materials the issue even though the measured surface tools are shader material in the editor and in remote during the during runtime and are rendered as the desired trader material in the game when addressed in code it returns a spatial material that is to say print object measures that get material zero transmission was interesting obviously um food throws an error no function sheet of ram that's weird that is very odd that it's returning a spatial material although it does make sense to me that it is a spatial material i'm kind of i'm more confused why it even says shader material but i'm confused why if it says shadow material in the editor that it's going to return this in code but yeah that is pretty odd i'm sorry why do you need to get the point are you just trying to solve this because it's interesting oh i see interesting yeah i'm sure that some that this seems like the kind of thing that uh has to do with exporting in blender or something like that that i'm just not aware of because i don't do 3d i've only used like a very small amount of 3d and shaders and stuff like that so i'm sure someone will answer your question though because i think this has to be something that's relatively common um so yeah sorry about that but this will definitely get asked all right i mean answered sorry kids can code will probably help you out there because it looks like he's active today no parenting rules interesting anyway yeah so sorry about that um anyways thank you guys so much for tuning in i might be back this week with a little more dev uh of me making the godot gamepad and stuff like that i don't really have any just like regular videos planned honestly i don't have any like things i really want to make i was going to do like bullets and godot and a bunch of different cool ways i found that you can make bullets like keep seeking missiles and crazy stuff like that but i don't know i've kind of like lost steam on that i kind of want to just build these things and live stream that i'm going to be trying to do these good old q and a things at least once a week so although i'll need to take like a one month break when i go back to california but i'll do my best to to try and be active during that time but yeah if you want to join my discord i'll go ahead and throw that link back in here again by people okay i heard there was indeed weird compatibility issues between godot and blender shaders yeah i have also heard that um like that that i've seen there was some guy talking about how to import him i totally forgot but he showed he went through every single possible like export option for blender and showed like what they do in godot and like which one he prefers and like how they work and stuff like that um i don't know how helpful it is that i'm just talking about it but uh yeah wait let's go see what this is i'm interested but um yeah that's about it um yeah anyway so i'll try and schedule these streams ahead of time i'll post them in my stream here and on the godot discord here so go ahead and join the discord if you're interested again if you have questions you want me to answer before the stream put them in the questions thing here i'll get to them as soon as i can subscribe and all that good stuff you know whatever whatever floats your boat um thank you guys so much for watching i'm gonna go ahead and leave the stream up for just a little bit so you guys can chat um in the chat because it seems like we've got some smart people in here maybe you guys can help each other but yeah thank you guys so much for watching have a great day you
Info
Channel: ACB_Gamez
Views: 218
Rating: undefined out of 5
Keywords:
Id: fC3384meGZA
Channel Id: undefined
Length: 178min 29sec (10709 seconds)
Published: Mon Jun 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.