How to Use SIGNALS Correctly in Godot 4 (everything to know)

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 พ.ย. 2024

ความคิดเห็น • 147

  • @AndyAndrewEntertaiment
    @AndyAndrewEntertaiment 8 หลายเดือนก่อน +46

    Ex-Unity user here. Just wanted to tell you that I was on the edge to go back to Unity after trying to get a signal between RayCast3D and an Animation player. Your tutorial was a life saver!

    • @dev-worm
      @dev-worm  7 หลายเดือนก่อน +7

      so happy to hear!! how's Godot been treating you??

    • @AndyAndrewEntertaiment
      @AndyAndrewEntertaiment 7 หลายเดือนก่อน +3

      @@dev-worm Good, for now. As I said, if you didn't made this super ex-Unity frendly tutorial, i would have gone back to Unity. thanks again!

    • @TheMegamanan
      @TheMegamanan 7 หลายเดือนก่อน +3

      Personally, as an Ex-Unity aswell, i like Signals so much more than Events

    • @AndyAndrewEntertaiment
      @AndyAndrewEntertaiment 7 หลายเดือนก่อน +1

      @@TheMegamanan Now I love them too, but I didn't understand them and now I feel a bit dumb...

    • @YoshimiMilk
      @YoshimiMilk 7 หลายเดือนก่อน +3

      Godot is not a Unity replacement though, but its nice to see you did not give up.

  • @MartinKendrik
    @MartinKendrik หลายเดือนก่อน +1

    Refreshing to have someone talking at faster pace. Very helpful

  • @YoKKJoni
    @YoKKJoni 8 หลายเดือนก่อน +3

    very helpful and clear! i heard 4 minutes and i figured it out thank you

    • @dev-worm
      @dev-worm  8 หลายเดือนก่อน

      so happy to hear that! glad I could help! thanks! if you ever need anything then please let me know!

  • @N3verGiveUp
    @N3verGiveUp 6 หลายเดือนก่อน +1

    Duuuuude..... I've been trying to do something similar to this for over a week and have done it 27 different ways and finding this got it to work... you are a legend and have helped with a lot of stuff i've been busy with. You champion!!

    • @dev-worm
      @dev-worm  6 หลายเดือนก่อน

      so happy to hear!!! thank you so much!! it means the world!! I am so glad it was able to help you out!! if you ever need anything then please just let me know!

  • @kristianlovealot
    @kristianlovealot 11 หลายเดือนก่อน +5

    Thanks, Devworm :) Just what I need to get a better understanding of signals! Can't wait to watch this later!

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน +1

      thank you, I'm happy to hear that! I hope the video is able to help you understand signals a bit better!

  • @ThunderPlayStudios
    @ThunderPlayStudios 3 หลายเดือนก่อน +3

    it's my first time i've to slow down a video. :D btw great content

    • @dev-worm
      @dev-worm  3 หลายเดือนก่อน

      haha i’m sorry!! i hope it was still helpful!! thank you so much!! ❤️

  • @ReddleyYT
    @ReddleyYT 11 หลายเดือนก่อน +4

    Thank you, love your guides! You've become one of my favorite Godot channels!

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน +1

      so happy to hear that, glad im able to help.. if you ever need anything then please let me know!

  • @cptstarshine
    @cptstarshine 7 หลายเดือนก่อน +8

    You made me understand signals! Didn’t think I would be able to get it ^^

    • @dev-worm
      @dev-worm  6 หลายเดือนก่อน +2

      so happy to hear!! thank you so much!! that means for than the world to me!!!

  • @PunCala
    @PunCala 11 หลายเดือนก่อน +4

    Great job once again. As is tradition, some topic suggestions: camera that always pans slightly to where you are looking at, cutscenes where you move the player and an npc with animations, cutscenes with dialogue, updating your dash video from years ago to Godot 4 (fixed distance dash or some other type of dash).

    • @dev-worm
      @dev-worm  10 หลายเดือนก่อน +4

      working on dash as we speak. thanks for the ideas ill look into them more!

    • @PunCala
      @PunCala 10 หลายเดือนก่อน

      @@dev-worm Thank you! Btw if you're working on the camera thing, please watch Game Maker's Toolkit video for reference: th-cam.com/video/TdWFzpgnljs/w-d-xo.html

  • @zongopbongo
    @zongopbongo 4 หลายเดือนก่อน +13

    I appreciate how quickly you speak

    • @oktayyildirim2911
      @oktayyildirim2911 4 วันที่ผ่านมา

      IMO it's offset by how long he draws everything out.

  • @Juicein
    @Juicein 10 หลายเดือนก่อน +4

    This is just what I needed! Thank you!🙏

    • @dev-worm
      @dev-worm  10 หลายเดือนก่อน

      Glad it was helpful!

  • @dasuper11
    @dasuper11 10 หลายเดือนก่อน +3

    I just came over from your RPG tutorial series, and I have to say that while it sounds like you have gotten more confident in your videos, you are also talking and doing stuff a lot faster. I feel like the pacing would benefit from you taking your time a bit more. Other than that, great video!

    • @dev-worm
      @dev-worm  10 หลายเดือนก่อน

      thank you, yes you are correct.. i am working on trying to breakdown everything in newer videos.. this one was pretty quick and i didnt like it to much either.

  • @Soulcode-k
    @Soulcode-k หลายเดือนก่อน

    17:18 truly helpful i was looking for something like this thanks.

    • @dev-worm
      @dev-worm  หลายเดือนก่อน

      so happy to hear!! thank you so much! i am glad it helped!

  • @Trupen
    @Trupen 11 หลายเดือนก่อน +2

    Thanks DevWorm

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน

      of course! anytime!

  • @tuckerwoollard2613
    @tuckerwoollard2613 7 หลายเดือนก่อน +2

    for those it may not be working for the "if body.has_method("Player"):" line in the enemy script is a way to check if a body enters does it have a func inside it named and in this case "player" so you can slap that into your player script for your enemy to detect and then transmit damage and its a unique func only to the player

  • @Cvrchak88
    @Cvrchak88 3 หลายเดือนก่อน

    Absolute gold mine of knowledge! Awesome!

    • @dev-worm
      @dev-worm  3 หลายเดือนก่อน

      Glad to hear that!

  • @Saint_Oscar
    @Saint_Oscar 2 หลายเดือนก่อน

    I am perfectly fine with how fast you talk. The complainers will need to pause the video anyways to follow your scripting. They can playback at a reduced speed.

  • @Bk15729
    @Bk15729 11 หลายเดือนก่อน +2

    Thanks man. Needed this

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน

      so happy to hear that!

  • @Goldy131992
    @Goldy131992 3 หลายเดือนก่อน

    Very well explained as always, keep up the great work!

    • @dev-worm
      @dev-worm  3 หลายเดือนก่อน

      thank you so much!! it means the world!!

  • @sergeym7213
    @sergeym7213 8 หลายเดือนก่อน +2

    Thanks for the tutorial, but what is the best way of connecting a signal emitted by another scene?

    • @USNTM2
      @USNTM2 8 หลายเดือนก่อน

      There's the event bus pattern. I recently saw a quick video on it on a channel called SaltyTheGeek (name stuck out).
      Essentially, from what I understand:
      Make a singleton called EventBus
      In the singleton, put any signals you need or want
      In your listener object's ready function, connect its function to the EventBus signal you needed
      Lastly, when the conditions are met, use the caller object to emit EventBus.emit_signal("your_signsl_here", parameters_here)
      Edit: the other channel (Salty) gave basic code on a pastebin. There wasn't any explanation other than loose comments in the code. But I got value from it because I watched the implementation and was able to understand the comments.

  • @steve_rico
    @steve_rico 5 หลายเดือนก่อน

    Very useful. Next research step is to understand how to pass these through an Event Handler script so I can scale my game and make multiple instances

  • @electricelf-music
    @electricelf-music 7 หลายเดือนก่อน

    You have no idea how long I have been searching for the answers that are well given in this video lol

    • @dev-worm
      @dev-worm  7 หลายเดือนก่อน +1

      so happy to hear!! thanks!

  • @Meowzer87
    @Meowzer87 4 หลายเดือนก่อน

    Thank you man. This answered so many questions that I had. 🙏

    • @dev-worm
      @dev-worm  4 หลายเดือนก่อน

      so happy to hear that!!

  • @tomodev45
    @tomodev45 10 หลายเดือนก่อน +1

    thanks for the tutorial!

    • @dev-worm
      @dev-worm  10 หลายเดือนก่อน

      of course anytime!

  • @901oi2
    @901oi2 4 หลายเดือนก่อน

    man i love your videos

    • @dev-worm
      @dev-worm  4 หลายเดือนก่อน

      thanks bro!! it means the world!!

  • @hemapoojari630
    @hemapoojari630 9 หลายเดือนก่อน

    The fact that I was watching the video without full screen and when he requested us to subscribe the subscribe button got a colorful border of neon colours for a fraction of seconda😅😅😅😅 I loved it 😂😂😂new feature huh

    • @dev-worm
      @dev-worm  9 หลายเดือนก่อน

      ah really?? must be.. that seems cool lol

  • @pixelsapling
    @pixelsapling 3 หลายเดือนก่อน

    I needed this so much
    thanks

    • @dev-worm
      @dev-worm  3 หลายเดือนก่อน

      i hope it helped!

  • @mincraft752
    @mincraft752 7 หลายเดือนก่อน +1

    Hey i love your videos u make everything so easy to understand . Can u please make a video about how to use this inventory plugin the documentation is quite hard to understand
    the plugin name is gloot v2.4.6 the latest version. i cannot send any links because my comments are being disappearing.

    • @dev-worm
      @dev-worm  7 หลายเดือนก่อน +1

      ill check it out, thanks!!

    • @mincraft752
      @mincraft752 7 หลายเดือนก่อน +1

      @@dev-worm Thanks!!!

  • @cg2713_
    @cg2713_ 3 หลายเดือนก่อน +1

    I have a question when you apply signals to an object and duplicate that object why don't the signals get saved to that duplicated object? also how do you connect signals to an instantiated object?

    • @dev-worm
      @dev-worm  3 หลายเดือนก่อน +1

      so to apply signals to an instantiated object, you would have to create a connect function within the receiving node, and in the instantiated node emit a signal from the script. So you wont be hard coding signals like we are doing here but instead creating a new one within the code and connecting it through the scene tree and through sometimes an autoload

  • @WunderChilld
    @WunderChilld 10 หลายเดือนก่อน

    Thanks for the videos brother, could you bring a video explaining how to enter/use some type of vehicle? whether horse, car, etc.

  • @cadenthornton9451
    @cadenthornton9451 2 หลายเดือนก่อน

    Hi! Do you have any advice on sending signals from nodes that are not yet in the scene tree? For example, if you wanted enemies to spawn in waves and send signals to the player.

  • @RichardRichyRichington
    @RichardRichyRichington 8 วันที่ผ่านมา

    Is this has_method just a quick way for you to demo, or is it relatively good practice to find objects? thanks.

  • @MochiRosu
    @MochiRosu 11 หลายเดือนก่อน

    MCSquirmy the Legend!

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน

      @MochiRosu the Legend!

  • @fvhaudsilhvdfs
    @fvhaudsilhvdfs 11 หลายเดือนก่อน +1

    could you clarify the significance of the signals and functions working together but passing differently-named variables? in example 3, the signal passes the variable "damage", and then the connection to that signal passes the function "damageAmount". I'm a bit confused about this part. how does Godot know what variable passes where when they're named differently? also, what is the practical purpose of being able to do this? (that is, why not just keep the names the same?)

    • @hadesiguess8516
      @hadesiguess8516 11 หลายเดือนก่อน +2

      I’ll split my answer into two parts to try to answer your questions better. Part 1 will be about how Godot handles differently named variables, and part 2 will be why this feature is useful.
      1) You can think of the variable's names as placeholders for the useful information being passed through. Naming a variable just allows you to show the program what to do with it like to set the amount equal to 20 for damage or subtract that value from health. When the function take damage is called it only knows the inputs value regardless of what it’s named where the function is being called
      2) In the example given there is no need for differently named variables as it was a very simple situation. In a more complex situation, you might have multiple different variables you would pass through depending on the current state, where you’d need more than 1 variable name so they couldn’t be the same.
      My answer was a bit longer and more complex than I’d like so let me know if you are still confused. I’m also not the most experienced at coding so anyone else please correct me if I explained anything incorrectly.

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน

      @@hadesiguess8516 that is a very good explanation of it

    • @fvhaudsilhvdfs
      @fvhaudsilhvdfs 11 หลายเดือนก่อน

      thanks for the detailed reply. regarding #1, I'm still confused about how Godot "knows" which variables are which in the case of multiple differently-named variables being passed. is it the order they appear in?@@hadesiguess8516

    • @GrunkleSoos
      @GrunkleSoos 11 หลายเดือนก่อน +1

      In addition to @hadesiguess8516 I just wanted to say that the way Godot knows which value to put in the renamed variable is by the order they are passed. So the first value passed will always go into the first variable and the second into the second etc.

  • @edwardskeyara
    @edwardskeyara 4 หลายเดือนก่อน +2

    I want you to know i appreciate you talking fast, my brain runs fast and everyone else is super slow.

    • @dev-worm
      @dev-worm  4 หลายเดือนก่อน +2

      i happy to hear that it was perfect for you!! thank you so much!! i am just so glad to help!

    • @MrMelonMonkey
      @MrMelonMonkey 2 หลายเดือนก่อน

      @@dev-worm hey, i dont dislike fast talking generally becuase i like it when you get to the point quick. but in your case i find it difficult to follow your rather "sloppy" pronunciation, as im not a native speaker. if you could talk a little more clearer it would be highly appreciated. and not just by me i figure ;)
      thanks for your awesome tutorials anyways, though.

  • @ElementalTJ
    @ElementalTJ 11 หลายเดือนก่อน

    You are the best!

    • @dev-worm
      @dev-worm  11 หลายเดือนก่อน +1

      thank you so much, youve just made my day! If you ever need any help with Godot then please let me know!

  • @Pelipcahh
    @Pelipcahh 11 หลายเดือนก่อน +1

    Can you make animations in one scene and then use signals to play them when an input is pressed in another scene?
    For example in your survival tutorial you have an arrow scene and before the arrow moves forward, during the charge (that I added to the bow where you have to hold the input for 1 second before an arrow flies) an animation is played where the arrow is pulled closer to the player and then it flies forward as described in your tutorial when the input is released.

    • @thesomeone2nd
      @thesomeone2nd 11 หลายเดือนก่อน

      Yea it sounds totally possible

  • @Garthritis
    @Garthritis 5 หลายเดือนก่อน

    Good stuff! Thanks

    • @dev-worm
      @dev-worm  5 หลายเดือนก่อน +1

      thank you so much!!

  • @AngelofD000M
    @AngelofD000M 7 หลายเดือนก่อน

    This is a fantastic tutorial, thank you so much!
    Although im sure it wont bog it down too much, but instead of calling the update_health function in the process method, why not put it in the take damage method, outside of the if statement? Over all, the entire thing will update, and no need to call it every frame.

    • @dev-worm
      @dev-worm  7 หลายเดือนก่อน +1

      good call out! must have had a brain fart! sorry I have no idea why I did that lol.. seems silly! but thanks! and glad the rest of the tutorial was good lol

    • @AngelofD000M
      @AngelofD000M 7 หลายเดือนก่อน

      @@dev-worm I appreciate the videos you make, they're concise, to the point, and gives plenty of different explanations on when to use them, and how to use them. Please keep making more videos, cause I know they helped me a bunch, and I'm positive they'll help others too! BTW the brain fart happens, its all good lol

  • @jitone1
    @jitone1 7 หลายเดือนก่อน

    I was trying to use the connect method to connect "open" signal to chests in multiply level scenes. Never go it to work right.

  • @Epsio0
    @Epsio0 8 หลายเดือนก่อน

    Need help clarifying something. I have a scene called ammo that I want to emit a signal to update a AnimatedSprite2D node.
    The AnimatedSprite2D node is a child node inside of a regular node, which is also a child node that's instance inside of my CharacterBody3D node (which I have saved as a player scene). I have a 3D node called world where both, ammo scene and player scene have been instantiated (I pressed the chain link icon in the scene window). How do I connect the signal through different nodes that are instantiated as a child scene?
    So imagine, in your second example, if the Example2Player has inside of it another node that I want to access.

  • @christo3058
    @christo3058 5 หลายเดือนก่อน

    This was very good and valuable! Many thanks. If it is possible for you to talk slower, that would be appreciated. Beside that technical detail, good job!

    • @dev-worm
      @dev-worm  5 หลายเดือนก่อน

      thank you! Im sorry about the talking speed and I will note that for future videos as I understand how it can be hard to receive information that way!!

  • @NamEch88
    @NamEch88 8 หลายเดือนก่อน

    Hello DevWorm!
    Your video is really helpful.
    Hope you can guide me on how to make a roguelike game like Brotato!

    • @dev-worm
      @dev-worm  8 หลายเดือนก่อน +1

      hey thank you so much! I'm actually working on a rogue like game tutorial series right now!

    • @NamEch88
      @NamEch88 8 หลายเดือนก่อน

      @@dev-worm Great! I look forward to it

  • @SheepUndefined
    @SheepUndefined 7 หลายเดือนก่อน +2

    I don't really get why you'd use has_method() and *then* call a signal on the object like that. That kind of feels like using signals to skirt around what is more or less already a bootleg interface pattern to me. (Bootleg only bc Godot forces us to duck type instead of using interfaces for some reason.) Just call the method, and stick to signals for bubbling up or global subscribable events that you don't want coupling on, this is adding extra complexity by using signals where they aren't needed.

    • @watcx
      @watcx 5 หลายเดือนก่อน +1

      He's just teaching horrible practices because he doesn't understand what he's doing himself.

  • @spasmodius8939
    @spasmodius8939 3 หลายเดือนก่อน

    thanks!

    • @dev-worm
      @dev-worm  3 หลายเดือนก่อน +1

      of course anytime! thank you!

  • @Lambert06Pasquale06
    @Lambert06Pasquale06 7 หลายเดือนก่อน

    Thank you. I will subscribe.
    I hope to learn from your videos. My question is, do you narrate these tutorials all in one breath? XD Jokes. They're really good.
    I started with intro Python and great Godot learning course early this year and it's like emotional epilepsy.
    What did come to mind was one of my best breakthroughs for understanding python was "100 days of programing with Python" on Udemy. I did only 7 days that was somehow posted on youtube, but none the less, doing many small incremental quizzes help massively. If I was a great programmer I would make the same thing for Godot. But self drive and not hand holding is best of course.

  • @Asilhan
    @Asilhan 7 หลายเดือนก่อน

    Thanks for the tutorial passing variables in the signals very useful but what if we create a node in signal?
    if bullet_cooldown == false:
    var new_bullet = bullet.instantiate()
    new_bullet.global_position = global_position
    var dir = global_position.direction_to(body.global_position)
    direct.emit(dir)
    #new_bullet.direction_2 = dir
    #call_deferred("add_child",new_bullet)
    add_child(new_bullet)
    bullet_cooldown = true
    bullet node:
    func _ready():
    $/root/World/Player.connect("direct",shoot)
    func shoot(direct):
    direction_2 = direct
    This code gives me 2 error.
    1) It says:
    "E 0:00:01:0455 player.gd:48 @ _on_gun_range_body_entered(): Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead." whenever I spawn a bullet.
    2) Bullets spawn when a enemy enter the range of player. But they don't move until another enemy moves in and only then it moves to closest enemy.

  • @shoggoth
    @shoggoth 7 หลายเดือนก่อน

    In example2, why not just have one signal and pass the colour as a parameter?

  • @Twisited
    @Twisited 11 หลายเดือนก่อน

    thanks

  • @Alikespan
    @Alikespan 7 หลายเดือนก่อน

    Hey devWorm, amazing video but i didnt found what I was looking for so im asking in comments: I got a Pause Menu scene with buttons and script. I got the resume button to work but I cant figure out the exit button. After i click it I want it to queue free itself and the level im on and then I want the main node to add Main menu scene as its child so I can pick a gamemode again. How can I do it?

  • @brisben88
    @brisben88 5 หลายเดือนก่อน

    Why do you create a method to identify bodies instead of defining groups? It makes no major difference as far as I can comprehend but it'd be good practice to define your bodies as part of a group and then use is_in_group to identify the body? Am I missing something?

    • @dev-worm
      @dev-worm  5 หลายเดือนก่อน +1

      no you are completely correct about that! unsure why I do it this way but thanks for pointing that out as I shouldnt be teaching this and I should be showing group and classes! thank you and sorry about this little hickup!

    • @brisben88
      @brisben88 5 หลายเดือนก่อน

      @@dev-worm no worries, thanks for the clarification!

  • @rangergreen1935
    @rangergreen1935 8 หลายเดือนก่อน

    So, idk if you or anyone else can help me here. Idk if im just trying to brute force this the wrong way or what.
    SO, I set my first signal on my animation to "on animation finished("spawn")" for my spawn animation to transfer into the idle one. But it refuses to let me apply the same logic to the damage animation going back into the idle one. Any idea what im doing wrong? It seems like there's just one output per signal but that has to be wrong

    • @dev-worm
      @dev-worm  8 หลายเดือนก่อน

      hm, not sure what is going on. you should try and start looking into creating a player state machine, because once your player gets more complex having a state machine is going to make things a lot easier... for the issue you are having now I have no idea! Is there any errors? have you tried print checking to make sure it engine is running through the code successfully? I really dont know what could be the case I'm sorry!

  • @MrGramno
    @MrGramno 11 หลายเดือนก่อน

    I have one question about signals, i have a player scene and a bullet scene. The bullet scene emits a signal if an area enters its area.
    So the question is how can i connect that signal to the ui, because the bullet is not in the scene it is instantiated with a button press ?

    • @InsanityForce
      @InsanityForce 11 หลายเดือนก่อน +2

      You can do it by code.
      If your bullet scene already has a script , probably in the bullet's _on_ready or_init() function, or another on that's called immediately after creation.
      Else, you can do it in the code that instanciates it, by connecting to the Bullet's Area2D (or whatever) 's signal. Not quite as clean as it requires other objects to "know" how missiles are built.
      The code would be something like :
      # if done in the bullet's script, "collided" is its signal declared in its script. self = the bullet, argument of UI's function on_bulley_hit(b : Bullet), Bullt being the bullet script's class_name.
      bullet_collided.connect(UI.on_bulley_hit.bind(self) )
      # if done in the script that instanciated it :
      bullet.collided.connect(UI.on_bulley_hit.bind(bullet) )
      # if bullet doesn't even have a script, assuming you use a Area2D and area_entered is the Area2D's signal.
      bullet.get_node("Area2DName").area_entered.connect(UI.on_bulley_hit.bind(bullet))
      # with UI's on_bulley_hit(bullet : Sprite2D or Node2D or whatever)

    • @tonnypedersen5915
      @tonnypedersen5915 10 หลายเดือนก่อน +2

      you could use a autoload singleton script and store you custom signals in that, that way dynamic loaded objects can communicate more easily.

  • @Frostbytedigital
    @Frostbytedigital 11 หลายเดือนก่อน +2

    I still dont get the point of custom signals. You couldve just called the method directly on the node. Ill use built in collision and control node signals but the custom ones still havent clicked with me.

    • @thesomeone2nd
      @thesomeone2nd 11 หลายเดือนก่อน +4

      If you continue using godot there will be a time where you gonna need them

    • @Frostbytedigital
      @Frostbytedigital 11 หลายเดือนก่อน +2

      @thesomeone2596 ok. For what? I'd love to know any "need" case. I have heard that you can't call methods of a node unless it's the child of the node, so you have to "signal up" but that isn't the case in the current godot version at least, you can call functions on any valid node that you can reference. I'm not saying there aren't use cases, I'm saying I haven't been able to find one that is simpler or better by another other metric Ive detected than just calling the method that is triggered by the signal I could've used.

    • @sataStrike
      @sataStrike 11 หลายเดือนก่อน +2

      You rarely NEED signals, but it's a very useful pattern that is easy to understand when it's triggered, as well as decoupling your code to maximize reusability and refactorability.
      Just think of all the built-in nodes. They all don't care about the other parts of your code because they use signals. So you can reuse those nodes as often as you like. This flexibility is achieved through the signal system. You can also google observer pattern or listener pattern, as that what signals actually are.

    • @USNTM2
      @USNTM2 11 หลายเดือนก่อน +1

      Needing a signal would be like a player object that is a child of the game world having a sibling that is the player's health bar. The health bar should not have anything to do with what's going on with the player's health, it just displays the value given to it. When the player's health changes, the player should emit a signal that is health changed, the new value, and whatever listeners are listening (the display) will do what it needs to do now that it has new information to work with.

    • @bingusbingus7860
      @bingusbingus7860 11 หลายเดือนก่อน +1

      Not sure if it’s optimal, but I emit a signal from certain creatures when the right timing/rng is met. This signal connects to the world/main and produces a dropped item given the location of the creature. Good example of this would be a chicken dropping an egg. Or a pig rooting up a mushroom. Or whatever. It’s abstracted to the point where the world has a function on_drop_resource that only needs an actor and a resource id.

  • @iamcookie1170
    @iamcookie1170 3 หลายเดือนก่อน

    instead of using body.has_method("player") it'd be a better practice to make the player a class using class_name player at the top of the script and then check if body is player

  • @WhiskeyBU2
    @WhiskeyBU2 4 ชั่วโมงที่ผ่านมา

    They really need caffeine warning labels on youtube videos 😂

  • @ongbui1796
    @ongbui1796 4 หลายเดือนก่อน +1

    On example 3 could I switch it around like instead of the enemy damaging the player could I use the same code but the player is the one damaging the enemy?

  • @mkaks22gamerserise16
    @mkaks22gamerserise16 6 หลายเดือนก่อน

    bro there is one issue you teach so fast and i am a beginner i need some time

    • @dev-worm
      @dev-worm  6 หลายเดือนก่อน

      sorry bro! if there was anything you couldnt understand feel free to ask me! Im sorry it was all a little to quick!

  • @snugglyjeff214
    @snugglyjeff214 9 หลายเดือนก่อน +31

    talk slower!

    • @dev-worm
      @dev-worm  9 หลายเดือนก่อน +12

      okay! sorry, ill try!

    • @andrejjjj2008
      @andrejjjj2008 8 หลายเดือนก่อน +8

      No, don’t! ❤

    • @ObsydianX
      @ObsydianX 7 หลายเดือนก่อน +6

      Playback 0.75 worked for me.

    • @biggusdickus6704
      @biggusdickus6704 6 หลายเดือนก่อน

      Indeed we have ways of slowing down if needed that’s good. But also kind of understand the comment up there. Might be good.
      In the end, the content is nice, thumbs up anyway.👍🏻

    • @ParacosmTV
      @ParacosmTV 4 หลายเดือนก่อน +2

      Definitely talk slower, wtf. Lol

  • @lazlohollyfeld3770
    @lazlohollyfeld3770 4 หลายเดือนก่อน

    Decent Tutorial but damn slow down.

    • @dev-worm
      @dev-worm  4 หลายเดือนก่อน

      i do apologize!! hope you were still able to get the information from it!

    • @lazlohollyfeld3770
      @lazlohollyfeld3770 4 หลายเดือนก่อน

      @dev-worm I do appreciate the effort and time it is hard to put yourself out there. Was just a little paced with your fast brain vs us slower people.

  • @JanusKjempff
    @JanusKjempff 7 หลายเดือนก่อน

    The way Godot uses signals is a wrong use of observer pattern. You should never have an object know their observer.
    To use correct observer patterns in Godot you should NOT use the signal emitting in the inspector; instead let your observers subscribe to the signal with code - Now your components are de-coupled aka they don't know about other components in your game = de-spaghettification and correct object oriented design.

    • @SheepUndefined
      @SheepUndefined 7 หลายเดือนก่อน

      Yeah I kind of noticed this myself when I tried to swap from Unity.
      I kinda prefer using a Bus pattern nowadays for most signals that aren't just bubbling up. Basically a singleton object that does nothing more than storing custom signals that other objects can call and subscribe to.

  • @JuanDiaz-ks7xy
    @JuanDiaz-ks7xy 11 หลายเดือนก่อน

    Hello, do you know of another way to pass arguments in built-in signals, like in the ‘pressed’ signal of a button? I found this method: button.pressed.connect(my_func.bind(my_arg)), but I’m curious if there’s another way

    • @chefaku
      @chefaku 8 หลายเดือนก่อน

      when connecting the signal 3:23 click on advanced, and you can add arguments

  • @Moonajuana
    @Moonajuana 7 หลายเดือนก่อน

    This is exactly what I needed, thank you so much!

    • @dev-worm
      @dev-worm  7 หลายเดือนก่อน

      happy to hear that! thank you!

  • @cadenthornton9451
    @cadenthornton9451 2 หลายเดือนก่อน

    Hi! Do you have any advice on sending signals from nodes that are not yet in the scene tree? For example, if you wanted enemies to spawn in waves and send signals to the player.

    • @xN1ghtF4llx
      @xN1ghtF4llx 2 หลายเดือนก่อน

      I am stuck on the same thing. Did you find an answer

    • @cadenthornton9451
      @cadenthornton9451 2 หลายเดือนก่อน

      @@xN1ghtF4llx I have not lol. Communication between nodes has been my main difficulty with Godot.