For anyone wondering why this project appears in a borderless window when running it, you can disable it in Project Settings > Display > Window > Borderless
[In Godot 4.0] It's No need to use callable in this case since the function owner is the node self. Just write as following: func _ready(): var timer = get_node("Timer") timer.timeout.connect(_on_Timer_timeout) And declare function "_on_Timer_timeout" as the video ( 10:46 ) did. Then it can run in Godot 4.0.
@@ponponyaya7890 Hello so I used your suggestion and got an error that says "Invalid type in function 'connect' in base ''Signal". Cannot convert argument 1 from String to Callable" Code: extends Sprite2D var speed = 400 var angular_speed = PI func _ready(): var timer = get_node("Timer") timer.timeout.connect("_on_Timer_timeout") func _process(delta): rotation += angular_speed * delta var velocity = Vector2.UP.rotated(rotation) * speed position += velocity * delta func _on_button_pressed(): set_process(not is_processing()) func _on_timer_timeout(): visible = not visible
@VariableArtist In your case, just write as following : timer.timeout.connect(_on_timer_timeout) I mean don't use "" here. Since it will be a String when you use "". And when you write function name without "", it will be recognized as a Callable in Godot 4. p.s. Godot is case sensitive, so make sure your function name is _on_timer_timeout here.
@@ponponyaya7890 Oh my god thank you so much. I am brand new to the engine and trying to learn this engine because as unity matures/updates the slower it runs on my computer. I have been enjoying the speed of godot a lot more than unity.
If you are following this tutorial with Godot 4.0 and you get an error of something like the following; "Invalid argument for "connect()" function argument 2 should be callable" - it's because the syntax for connecting signals must have changed in version four. Change the _ready() function to look like this; func _ready(): var timer = get_node("Timer") timer.timeout.connect(self._on_Timer_timeout) The concepts are the same - it's just the syntax that's changed.
when I ran into this problem I copied/adapted the following from the documentation: timer.connect("timeout", Callable(self, "_on_Timer_timeout")) This worked first time. I then copied the solution here (which also works): timer.timeout.connect(_on_Timer_timeout) Is one more correct than the other? Can someone with more experience please explain why both work and what's going on? Much thanks :)
@@autumnshade84 According to the documentation on connect() you should use timer.timeout.connect(_on_Timer_timeout) in most cases because it's faster and has better validation (you get an error in the editor if either the timeout signal or the _on_Timer_timeout function doesn't exist, so you won't make mistakes like misspelling or using wrong case). The other option should mainly be used "if you actually need to use strings (e.g. to connect signals programmatically based on strings read from a configuration file)", to quote the docs. Basically, use timer.timeout.connect unless you don't know when writing the code what you want to connect to/from (which you probably know in 99% of all cases).
Thank you. Question, why the auto fill doesn't kick appear when I time "timer.". It doesn't show timeout. The code worked, I was just curious to how it doesn't auto fill. Also, how did you find the solutions to this tutorial problem? Again, thank you!
@GorEldeen ram does not define performance, you should look into the cpu and gpu components instead having 8gbs of ram doesn't guarantee a smooth experience in unity when the rest of your pc lacks in power
An interesting thing i found while following along with this tutorial is that the bool type is not also considered an INT Type in GDScript like it is in python and C++
One useful fact that wasn't mentioned was that you can connect the signal to more than one node, useful if you want more than one funciton/node to run at the same time a signal is called. You can also attach it to preexisting functions in the node it's connected to as well.
The custom signal one doesn't work in v4, and I'm too new to this kind of stuff to understand why. First off, it doesn't recognize "onready" in the enemy's script. Second, the enemy doesn't reach the player, therefore not colliding and not dealing damage. Does anyone have a fix?
This was incredibly useful! I have recently started using Godot and while I was able to understand linking signals through the UI pretty easily though the website tutorial, I couldn't grasp how to link via scripting. This video was very clear and concise and thanks to it I was able to get the utility I wanted in my game working.
As usual, on our website, you will find extra insights to go further: www.gdquest.com/tutorial/godot/learning-paths/getting-started-in-2021/chapter/9.using-signals/
he knows I have the full GDQuest course, but this is the simplest way of explaining it, also you don't need to declare variable inside _ready you can call on ready var, but he knows all this stuff just explaining it in a simple way.
I can't connect the signal via code. It doesn't show the "timeout" and i went back and redid it and now it doesn't even display the "timer" in the first ready function It says node not found in the output
i now see why you asked us to start with cs50 or some other intro coding course xD need a lot of functional thinking and sending inputs and outputs and stuff to understand stuff so far
At 14:43 on the line of code: get_node("AnimationPlayer").play("take_damage") Could this line of code be placed somewhere else within the 'take damage' function? Like maybe above the 'health -= amount' modifier, or would this cause an issue? I also noticed that it's only indented once within the 'take damage' function. I'm assuming that means that the animation will play every time the 'take damage' function is run, even if health isn't below 0. Is this correct? I would test this myself, but I don't have my computer with me right now. Any help would be appreciated!
You can place that line at the top or the end of the function, no problem here. As for indents, if you added one indent level, it would only run if health is lower than 0. Here, I wanted it to run every time you take damage, that's why I left it outside the condition block.
I was on the wrong tutorial page. I'm asking if there is a series that is in order with this that goes through finishing this particular game "using signals"?
Hmm the _on_Timer_timeout function didn't work for me just writing it in code. But after writing it, when I manually connected it in the editor UI it started working. Seems like the script doesn't make the signal connection just from the code and you have to manually click connect.
That's exactly right. Seems to me that by clicking the Connect button (and naming your method), you tell the engine to create a link in the background that references your new method (_on_Timer_timeout)and thus calls it up whenever the signal is emitted. Godot seems to hide this part from us to keep the code lean and focused.
Can someone explain the logic behind WHERE I have to put the connect Function? In what node do I have to put it? The emitting one or the receiving? I don't understand the difference between the source node and target node. Is source node the emitting node?
I'm fairly new to Godot but in C#, the emitting node is the source node. Think of it this way. It's like if you have information that your neighbors need to know, you can send a message to the neighborhood, but only the ones interested will listen. The "emitting" would be attached to you and the function that does something is attached to them, so they can choose to do something or not. (I'm relying on my C# background, I'm sure Godot works the same). Another side feature of signals is being able to call a function on another node in another Scene. It keeps the code from becoming spaghetti, by having self containing functions. The left hand does not need to know what the right hand is doing as long as they can pass a value or "Signal" Hope this helps :)
i would like to see how to approach signals in big real life game, ie. how to organise them so that it is not so tightly coupled and where game is just bigger
It seems kind of similar to SendMessage in Unity. I'm not sure anyone still uses that function. It's just a really clunky way of calling a function on another object (calling functions by string). Am I correct?
Hey GDQuest. Is there a clean way to check if a node has a signal? I have a parent node with a list of child nodes. Some of the child nodes have a custom signal. I want my parent to go through the list of children and subscribe to a signal, if a child has it, if not just skip. What would be a good way to do this in Godot, through code?
to anyone that is getting an: > Node not found: "Timer" (relative to "/root/ToggleMotion/Godot"). error, replace var timer = get_node("Timer") with var timer = Timer.new() edit: nvm, i was just a dumbass, and didnt make timer node to be godot note child....
No. In GDScript for one, you don't want to use get_node("."). It's unnecessary work: you have the engine parse the node path argument to find the reference to the current node the script is attached to. It doesn't do anything useful as far as I know. Self or this is a different concept, mostly unnecessary in GDScript, but note it works even if you're not dealing with a node, which is the first difference. If your script extends Object, Reference, or Resource, "get_node()" isn't available because that's a function of the Node class. Then, in Godot 3, I only know one case where you may use self concretely: to have a variable assignment go through a setter function. It's a little design flaw of the current GDScript that's addressed in Godot 4. Self means you're acting or accessing things on an instance of the class (an instance of the node with the script attached to it or an object created from this script in code). Unlike other programming languages, this is implicit in GDScript: every script is a class definition.
If you're watching this for Godot4, they switched it to a "Callback type". Something like this will work: %Timer.timeout.connect(self._on_timer_timeout) It's actually pretty nice this way!
The button doesn't appear when I press F5 :/ Edit: Never mind, it somehow worked by me just changing the main scene to a different one, and back to the original one. That's weird.
I get that the player health was for teaching custom signals but I think ideally Life bar and stuff like mana etc should be child of the player node and then interact simply from code to the child node. It is better from readability as well that health is part of the player. However In case of a boss health for example which is totally different from player health or any other health bar in the main scene custom signals will be better :)
It really depends on the rest of the structure of the game. To me it makes more sense for the health bar to be a child of a node which controls UI, than a child of the player itself. It makes arranging the UI simpler, both in the editor and in game.
Hi, can any one help me out. so i follow everything and anything that's typed in the comment, but i still get an error that says "cannot connect to "timeout"; the provided callable is null", i'm using GoDot 4 Thanks!
you can, he did mention it but its to show that there are multiple methods to do that and _ready() initializes the objects the moment the game is started
I have a question. I noticed that there are no windows decorations. though when I made a new scene and wrote it up myself in Windows there are window decorations when I press F6. Is there a reason for this?
What I don't undestand is how do I set up a signal that will be recieved by a node that doesn't exist yet, and will be generated later in code? It seems like the object needs to exist for the onready function to not produce an error, but if it won't exist until much later in the game loop when I generate it as a scene instance, how am I supposed to get any signals attached between them?
In order to generate it, doesn't it need to have a scene or script already? I mean it exists in code when you create a new scene and then you create it on the screen by using it's Scene object? Or am I missing something. Can you create a scene object on the fly?
because when timer emots sognal timeout() we set variable 'visible' to not visible which just means we are setting it to what it is not(if its true we set it to false, if its false we set it to true)
Ok so I'm not sure if this really teaches how custom signals work as the organization of the example project is far too simple. I'm trying to set up hazardous zones that will take health away from the player upon entering them. I don't want to make a custom Area node for detecting each different collision layer or item I want to add to the game. Is there any way I can create an Area that checks for labels and values put onto other Areas? Say the hazardous zone is labeled as health_trigger and has a value of 1 to take away 1 health from the player upon entering it, how can I set up an Area node tied to the player to check for the label of the hazard zone and distribute the value into an equation for subtracting the value given? I've seen something like this done in Cruelty Squad's source code scripts where balls of gas are just labeled as "hurt" along with a value, and the player is set up to detect for that label and value.
13:46 is it possible define that something that collides with the player (for example if spike.tscn collides with player player takes damage, but when ground.tscn collides gravity stops). I'm a begginer if it isn't obvious.
Okay, but the '_on_Player_health_changed' function feels EXTREMELY arbitrary. Is there not a more rigorous way to listen for a signal from a specific object?
In the _on_Button_pressed function, after the set_process command you check if is_processing() is true. If it is you connect the timeout signal, or disconnect the timeout if it is not.
I know I'm 2 months old but to fix this you can go to : Project > Project settings > Run and then at "Main Scene" you clic the folder to browse it and select "Toggle Motion.tscn" (or whatever name you named this scene)
I just realized something while following your tutorial. The function we created in the previous video _process() it seems that it is always running even when it has not been called yet. In python (which was what I learned before this), when you define a function for instance def funtion(): . you still need to write funtion() after to initiate the function but that doesn't seem to be the case here. Can someone explain why this function is always running? I assume it's because of the name _process but I would like some confirmation. Edit: I hope someone reads this because the video is a year old.
this is a function reserved by the engine, like _phisics_process(), _ready() or _input(). You can read about it in the official documentation, sometimes it's even more useful than a video.
No but you do need 3D models. You could possibly download, import, rig, and use 3D assets from the web and never need to modify them in Blender. Having na knowing how to use blender will make modifying models you find much easier.
@@__Rizzler__ yes. As Tom said, if you're just starting out, either one will definitely be able to do all you (realistically) need and more. My 2 cents is: Godot is open source and free, but for practical purposes that won't matter at the start. It's 2D side is stronger, but a new version is approaching with many updates on the 3D side, which is still very capable, specially if you're just starting out. I like the scene system and GD Script may be nice to start off, since it's a language built specifically to work with godot: it's probably more efficient to first warp your head around that. There are quite a few tutorials and resources on Godot development out there - not as much as for Unity, but definitely more than enough to get you started. Godot is very light weight as well. Unity has a crazy lot of tutorials and pre-built things all around, probably more mature 3D (which shouldn't matter much as you're starting out). It has way more market presence (say, if you look for freelancing jobs someday) and an easier flux to export games to consoles and what not. All in all, learning either one will make picking up the other way easier. In fact it's probably a good idea to get a nice hang of one of them and then give the other a little spin (open minded) to see what you think. But again, by far the most important thing is to just get started. If you find yourself unable to decide just flip a coin : )
I saw that the godot game engine will be renamed to godette, but from my observation of this game engine, I noticed that the games that are created in it cannot be hacked by cheaters, so i will be using this engine to make my games.
This tutorial could have been just the last 6 minutes. I've been looking for a quick and clear tutorial on Signals for half an hour and people insist in making 15-30 minute videos that are 90% creating buttons and nodes instead of jumping straight to THE POINT OF THE VIDEO. What a waste of time...
Loving these tutorials but i can't deny some frustrations: Calling individual game objects as 'Scenes' is really confusing (especially to former Unity users) underscores at the beginner of functions makes me shudder (though i do like how functions can connect to other scenes through their names and i'm guessing this allow a breadcrumb trail) func - i know void isn't much better, but this is a whole new version of wave of hungarian notation
✦✦✦ NEW VIDEO ON SIGNALS IN GODOT 4 ✦✦✦ czcams.com/video/Qlq8pBB2htg/video.html
For anyone wondering why this project appears in a borderless window when running it, you can disable it in Project Settings > Display > Window > Borderless
In Godot 4 it's changed to:
func _ready():
var timer = Callable(self, "_on_timer_timeout" )
and then
func _on_timer_timeout():
visible = not visible
[In Godot 4.0]
It's No need to use callable in this case since the function owner is the node self.
Just write as following:
func _ready():
var timer = get_node("Timer")
timer.timeout.connect(_on_Timer_timeout)
And declare function "_on_Timer_timeout" as the video ( 10:46 ) did.
Then it can run in Godot 4.0.
@@ponponyaya7890 Ok thanks!. I've only been learning Godot and GDscript for a few days so I referenced that from another video.
@@ponponyaya7890 Hello so I used your suggestion and got an error that says "Invalid type in function 'connect' in base ''Signal". Cannot convert argument 1 from String to Callable"
Code:
extends Sprite2D
var speed = 400
var angular_speed = PI
func _ready():
var timer = get_node("Timer")
timer.timeout.connect("_on_Timer_timeout")
func _process(delta):
rotation += angular_speed * delta
var velocity = Vector2.UP.rotated(rotation) * speed
position += velocity * delta
func _on_button_pressed():
set_process(not is_processing())
func _on_timer_timeout():
visible = not visible
@VariableArtist
In your case, just write as following :
timer.timeout.connect(_on_timer_timeout)
I mean don't use "" here.
Since it will be a String when you use "".
And when you write function name without "", it will be recognized as a Callable in Godot 4.
p.s. Godot is case sensitive, so make sure your function name is _on_timer_timeout here.
@@ponponyaya7890 Oh my god thank you so much.
I am brand new to the engine and trying to learn this engine because as unity matures/updates the slower it runs on my computer. I have been enjoying the speed of godot a lot more than unity.
If you are following this tutorial with Godot 4.0 and you get an error of something like the following; "Invalid argument for "connect()" function argument 2 should be callable" - it's because the syntax for connecting signals must have changed in version four. Change the _ready() function to look like this;
func _ready():
var timer = get_node("Timer")
timer.timeout.connect(self._on_Timer_timeout)
The concepts are the same - it's just the syntax that's changed.
when I ran into this problem I copied/adapted the following from the documentation:
timer.connect("timeout", Callable(self, "_on_Timer_timeout"))
This worked first time.
I then copied the solution here (which also works):
timer.timeout.connect(_on_Timer_timeout)
Is one more correct than the other? Can someone with more experience please explain why both work and what's going on? Much thanks :)
@@autumnshade84 According to the documentation on connect() you should use timer.timeout.connect(_on_Timer_timeout) in most cases because it's faster and has better validation (you get an error in the editor if either the timeout signal or the _on_Timer_timeout function doesn't exist, so you won't make mistakes like misspelling or using wrong case). The other option should mainly be used "if you actually need to use strings (e.g. to connect signals programmatically based on strings read from a configuration file)", to quote the docs. Basically, use timer.timeout.connect unless you don't know when writing the code what you want to connect to/from (which you probably know in 99% of all cases).
Thank you. Question, why the auto fill doesn't kick appear when I time "timer.". It doesn't show timeout.
The code worked, I was just curious to how it doesn't auto fill. Also, how did you find the solutions to this tutorial problem? Again, thank you!
Your a life saver thank you
I am thankful to the comments that have information to help update the code here
I'm not even using Godot, I just enjoy watching your videos because you make learning this stuff so interesting
Me too bro
@Gor Eldeen me not too now either xD im a godot bro now
@Gor Eldeen bro i want the straight answer. Which engine is better so that I will not regret later
@GorEldeen ram does not define performance, you should look into the cpu and gpu components instead
having 8gbs of ram doesn't guarantee a smooth experience in unity when the rest of your pc lacks in power
@goreldeen won't you similarly get stuck I unity?
An interesting thing i found while following along with this tutorial is that the bool type is not also considered an INT Type in GDScript like it is in python and C++
I stumbled upon that aswell, luckily for anyone curious you can cast any bool to an int simply by sayiNg "int(*bool goes here*)" without quotes
I've just binged all of the vids in the course, I'm subbed and strapped in lets goooo!!!
This is legit the best tutorial I've ever seen on godot, thankyou
finally, thank you, I've been looking for a tutorial on signals emit values and no one talks about it :)
omg thanks man thats actually exactly what i needed
Right as im trying to implement a signal into my first game. Thanks !
One useful fact that wasn't mentioned was that you can connect the signal to more than one node, useful if you want more than one funciton/node to run at the same time a signal is called. You can also attach it to preexisting functions in the node it's connected to as well.
The custom signal one doesn't work in v4, and I'm too new to this kind of stuff to understand why.
First off, it doesn't recognize "onready" in the enemy's script.
Second, the enemy doesn't reach the player, therefore not colliding and not dealing damage.
Does anyone have a fix?
This was incredibly useful! I have recently started using Godot and while I was able to understand linking signals through the UI pretty easily though the website tutorial, I couldn't grasp how to link via scripting. This video was very clear and concise and thanks to it I was able to get the utility I wanted in my game working.
I like watching your videos at x2 speed. Great content.
As usual, on our website, you will find extra insights to go further: www.gdquest.com/tutorial/godot/learning-paths/getting-started-in-2021/chapter/9.using-signals/
Thank you for the time it took to make this. Very informative.
Thank you for another great tutorial 🥰💕
WOW! you have got the talent to make interesting tutorials
Epic. I'ma download this. Thanks for getting it out early!
Fun Fact: You dont have to write "get_node("Timer")" you can actually instead write "$Timer"
he knows I have the full GDQuest course, but this is the simplest way of explaining it, also you don't need to declare variable inside _ready you can call on ready var, but he knows all this stuff just explaining it in a simple way.
Great resources! New SUBS here.. toying with GD for a month now 🤭
I can't connect the signal via code. It doesn't show the "timeout" and i went back and redid it and now it doesn't even display the "timer" in the first ready function
It says node not found in the output
great video, especially for someone who knows nearly nothing about coding !! keep the good work up, mate :)
Thank you so much for sharing your experience with us. God bless you .
thats exactly what i was searching for
thnx
Thank you very much you just helped me with a school project
i now see why you asked us to start with cs50 or some other intro coding course xD need a lot of functional thinking and sending inputs and outputs and stuff to understand stuff so far
can't wait for next video!
At 14:43 on the line of code:
get_node("AnimationPlayer").play("take_damage")
Could this line of code be placed somewhere else within the 'take damage' function? Like maybe above the 'health -= amount' modifier, or would this cause an issue?
I also noticed that it's only indented once within the 'take damage' function. I'm assuming that means that the animation will play every time the 'take damage' function is run, even if health isn't below 0. Is this correct? I would test this myself, but I don't have my computer with me right now. Any help would be appreciated!
You can place that line at the top or the end of the function, no problem here.
As for indents, if you added one indent level, it would only run if health is lower than 0. Here, I wanted it to run every time you take damage, that's why I left it outside the condition block.
@@Gdquest awesome. thank you!
@@Gdquest Yeah, watch your indents. I had a terrible time debugging a function that had an indenting issue. I used spaces and screwed myself.
Thank you good youtube man
I was on the wrong tutorial page. I'm asking if there is a series that is in order with this that goes through finishing this particular game "using signals"?
I was just wondering about this!
Thank you very much!
Thank you!
How can I change the total health of the life bar? When I set the health variable to 20, the health reduction works only after 5 collides.
Holy cow, that is so much friendlier to use than Unity's event system.
Hmm the _on_Timer_timeout function didn't work for me just writing it in code. But after writing it, when I manually connected it in the editor UI it started working. Seems like the script doesn't make the signal connection just from the code and you have to manually click connect.
That's exactly right. Seems to me that by clicking the Connect button (and naming your method), you tell the engine to create a link in the background that references your new method (_on_Timer_timeout)and thus calls it up whenever the signal is emitted. Godot seems to hide this part from us to keep the code lean and focused.
Can someone explain the logic behind WHERE I have to put the connect Function? In what node do I have to put it? The emitting one or the receiving? I don't understand the difference between the source node and target node. Is source node the emitting node?
I'm fairly new to Godot but in C#, the emitting node is the source node. Think of it this way. It's like if you have information that your neighbors need to know, you can send a message to the neighborhood, but only the ones interested will listen. The "emitting" would be attached to you and the function that does something is attached to them, so they can choose to do something or not. (I'm relying on my C# background, I'm sure Godot works the same).
Another side feature of signals is being able to call a function on another node in another Scene. It keeps the code from becoming spaghetti, by having self containing functions. The left hand does not need to know what the right hand is doing as long as they can pass a value or "Signal"
Hope this helps :)
@@GaryParkin Great reply, this really helped me.
@@91bravic12 awesome. I'm so glad it helped.
i would like to see how to approach signals in big real life game, ie. how to organise them so that it is not so tightly coupled and where game is just bigger
It seems kind of similar to SendMessage in Unity. I'm not sure anyone still uses that function. It's just a really clunky way of calling a function on another object (calling functions by string). Am I correct?
Hey GDQuest. Is there a clean way to check if a node has a signal?
I have a parent node with a list of child nodes. Some of the child nodes have a custom signal. I want my parent to go through the list of children and subscribe to a signal, if a child has it, if not just skip. What would be a good way to do this in Godot, through code?
to anyone that is getting an:
> Node not found: "Timer" (relative to "/root/ToggleMotion/Godot").
error, replace
var timer = get_node("Timer")
with
var timer = Timer.new()
edit: nvm, i was just a dumbass, and didnt make timer node to be godot note child....
Your comment made me realize that I made the same mistake with not making the timer a Godot child....
Very useful
9:49 Out of curiosity, would be the same to put "get_node(".")" instead of "self"?
No. In GDScript for one, you don't want to use get_node("."). It's unnecessary work: you have the engine parse the node path argument to find the reference to the current node the script is attached to. It doesn't do anything useful as far as I know.
Self or this is a different concept, mostly unnecessary in GDScript, but note it works even if you're not dealing with a node, which is the first difference. If your script extends Object, Reference, or Resource, "get_node()" isn't available because that's a function of the Node class.
Then, in Godot 3, I only know one case where you may use self concretely: to have a variable assignment go through a setter function. It's a little design flaw of the current GDScript that's addressed in Godot 4.
Self means you're acting or accessing things on an instance of the class (an instance of the node with the script attached to it or an object created from this script in code). Unlike other programming languages, this is implicit in GDScript: every script is a class definition.
Спасибо!
If you're watching this for Godot4, they switched it to a "Callback type".
Something like this will work:
%Timer.timeout.connect(self._on_timer_timeout)
It's actually pretty nice this way!
The button doesn't appear when I press F5 :/
Edit: Never mind, it somehow worked by me just changing the main scene to a different one, and back to the original one. That's weird.
happened to me too thanks :)
You should really consider moving this kind of content over to Nebula!
write the funky word
what if the signal was for an instance that spawn in midel of game not in the scene bar
I get that the player health was for teaching custom signals but I think ideally Life bar and stuff like mana etc should be child of the player node and then interact simply from code to the child node. It is better from readability as well that health is part of the player.
However In case of a boss health for example which is totally different from player health or any other health bar in the main scene custom signals will be better :)
It really depends on the rest of the structure of the game. To me it makes more sense for the health bar to be a child of a node which controls UI, than a child of the player itself. It makes arranging the UI simpler, both in the editor and in game.
the signal system is similar to the scratch signal system but with written code
Hi, can any one help me out.
so i follow everything and anything that's typed in the comment, but i still get an error that says
"cannot connect to "timeout"; the provided callable is null", i'm using GoDot 4
Thanks!
My GMS soft like a motor bike! pls tell WHAT to do ?
What is purpose connecting the signal via code? I tested it by making it into a comment while leaving the signal function there and it acts the same.
how does the status bar of health know that the maximum health is 10 units?
Why not use the connect method for both the timer and the button-Pressed? I don't see the point of the whole _ready function.
you can, he did mention it but its to show that there are multiple methods to do that and _ready() initializes the objects the moment the game is started
I have a question. I noticed that there are no windows decorations. though when I made a new scene and wrote it up myself in Windows there are window decorations when I press F6. Is there a reason for this?
nice ;D
1:27 - secret-files...
I need to know.
What I don't undestand is how do I set up a signal that will be recieved by a node that doesn't exist yet, and will be generated later in code? It seems like the object needs to exist for the onready function to not produce an error, but if it won't exist until much later in the game loop when I generate it as a scene instance, how am I supposed to get any signals attached between them?
In order to generate it, doesn't it need to have a scene or script already? I mean it exists in code when you create a new scene and then you create it on the screen by using it's Scene object? Or am I missing something. Can you create a scene object on the fly?
When setting up the blink timer, why does the head become visible again? What causes the visibility variable to reset to True?
because when timer emots sognal timeout() we set variable 'visible' to not visible which just means we are setting it to what it is not(if its true we set it to false, if its false we set it to true)
Ok so I'm not sure if this really teaches how custom signals work as the organization of the example project is far too simple. I'm trying to set up hazardous zones that will take health away from the player upon entering them. I don't want to make a custom Area node for detecting each different collision layer or item I want to add to the game. Is there any way I can create an Area that checks for labels and values put onto other Areas? Say the hazardous zone is labeled as health_trigger and has a value of 1 to take away 1 health from the player upon entering it, how can I set up an Area node tied to the player to check for the label of the hazard zone and distribute the value into an equation for subtracting the value given? I've seen something like this done in Cruelty Squad's source code scripts where balls of gas are just labeled as "hurt" along with a value, and the player is set up to detect for that label and value.
13:46 is it possible define that something that collides with the player (for example if spike.tscn collides with player player takes damage, but when ground.tscn collides gravity stops). I'm a begginer if it isn't obvious.
Okay, but the '_on_Player_health_changed' function feels EXTREMELY arbitrary. Is there not a more rigorous way to listen for a signal from a specific object?
I want to make the godot blink only while moving, how can I that? (when the godot is stopped I want to make it visible regardless of the timer)
In the _on_Button_pressed function, after the set_process command you check if is_processing() is true. If it is you connect the timeout signal, or disconnect the timeout if it is not.
3:44 I have done the exact something but when i press f5 my button disappears, I'm a complete beginner, plzz help me out
I know I'm 2 months old but to fix this you can go to :
Project > Project settings > Run
and then at "Main Scene" you clic the folder to browse it and select "Toggle Motion.tscn" (or whatever name you named this scene)
actually it was probably because you were using F5 instead of F6 to test
Why I wrote down the codes exactly the same as yours in your last signal tutorial but the lifebar wasn't changed?
You may have made a little typo or not connected the signal exactly the same as in the video. If you did, it should work.
Out of interest, what sort of soft are you hoping to produce?
I just realized something while following your tutorial. The function we created in the previous video _process() it seems that it is always running even when it has not been called yet. In python (which was what I learned before this), when you define a function for instance def funtion(): . you still need to write funtion() after to initiate the function but that doesn't seem to be the case here. Can someone explain why this function is always running? I assume it's because of the name _process but I would like some confirmation.
Edit: I hope someone reads this because the video is a year old.
this is a function reserved by the engine, like _phisics_process(), _ready() or _input(). You can read about it in the official documentation, sometimes it's even more useful than a video.
if i want to make a 3D game do i have to download blender ?
Blender is great. You cant get better models than using some built it tool than blender
No but you do need 3D models. You could possibly download, import, rig, and use 3D assets from the web and never need to modify them in Blender. Having na knowing how to use blender will make modifying models you find much easier.
how area2d is moving?
so signals are ascended version of global variables
Signals are just callbacks. It's just we use some magic to connect callbacks without passing references explicitly.
Little bit confused, could we use programmatic connect() via code, instead of connecting via UI, for custom signal?
Sure! They work the same as built-in ones.
I'd recommend only connecting from code. Makes it easier to manage.
13:46
Should i learn godot or unity? Which is best? Plz say
Just start learning. That will do the best
It depends on what you want to do and what experience you already have. GDQuest has a Godot vs Unity video that goes into more detail.
@@Any_key404 does godot have particle effect?
@@__Rizzler__ yes. As Tom said, if you're just starting out, either one will definitely be able to do all you (realistically) need and more.
My 2 cents is:
Godot is open source and free, but for practical purposes that won't matter at the start. It's 2D side is stronger, but a new version is approaching with many updates on the 3D side, which is still very capable, specially if you're just starting out. I like the scene system and GD Script may be nice to start off, since it's a language built specifically to work with godot: it's probably more efficient to first warp your head around that. There are quite a few tutorials and resources on Godot development out there - not as much as for Unity, but definitely more than enough to get you started. Godot is very light weight as well.
Unity has a crazy lot of tutorials and pre-built things all around, probably more mature 3D (which shouldn't matter much as you're starting out). It has way more market presence (say, if you look for freelancing jobs someday) and an easier flux to export games to consoles and what not.
All in all, learning either one will make picking up the other way easier. In fact it's probably a good idea to get a nice hang of one of them and then give the other a little spin (open minded) to see what you think.
But again, by far the most important thing is to just get started. If you find yourself unable to decide just flip a coin : )
@@user-sl6gn1ss8p dude thanks for your novel but which should i pick godot- c# or godot-gd script?
I want to scream, I forgot to create the signal keyword and signal name to make "emit_signal" actually work later in the code...
I saw that the godot game engine will be renamed to godette, but from my observation of this game engine, I noticed that the games that are created in it cannot be hacked by cheaters, so i will be using this engine to make my games.
But you cannot hack popularity
@@uhfan22 True.
dastxosh
Is it possible to use godot to make a game on the WAXP blockchain?
This tutorial could have been just the last 6 minutes. I've been looking for a quick and clear tutorial on Signals for half an hour and people insist in making 15-30 minute videos that are 90% creating buttons and nodes instead of jumping straight to THE POINT OF THE VIDEO. What a waste of time...
Loving these tutorials but i can't deny some frustrations:
Calling individual game objects as 'Scenes' is really confusing (especially to former Unity users)
underscores at the beginner of functions makes me shudder (though i do like how functions can connect to other scenes through their names and i'm guessing this allow a breadcrumb trail)
func - i know void isn't much better, but this is a whole new version of wave of hungarian notation
Godot 4: Remove self in timer.connect arguments. That's it.
its a funckey world, aint it?
under sco
ahem I wanted to say
WTF YOU MEAN BY CLICKING RIGHT CLIKS IM ON MOBILE!