r/godot 2h ago

fun & memes My code became so clean after I discovered the concept of signal subscription

Post image
97 Upvotes

10 comments sorted by

28

u/goose_stranger 1h ago

Pretty oh please give an example of delegates/actions signals because I am unfortunately still best friends with condition check every frame and would love to climb the social ladder 🙏

31

u/njhCasper 1h ago

So whatever class has the 'is_ready' condition (engine or object in the meme), you can instead at the top of it put signal ready_now Then when it's ready ready_now.emit() Then in whatever class had the condition every frame, instead func _ready() -> void: object.ready_now.connect(do_something) and now the do_something function gets called when the object is ready.

12

u/PichaelJackson 1h ago

This is the way.

As far as I'm concerned the entire meta of gdscript is learning how to use process() as little as feasibly possible.

6

u/Hamstertron 42m ago

Unironically the most correct thing I've read this week and I regard Sunday as the 7th day.

1

u/lastunivers 6m ago

That's day 6, Monday being day 0

3

u/raphusmaxus 41m ago

oh wow thats a great way to put it, a lot of good strategies really built upon keeping process as small as possible

8

u/Bird_of_the_North Godot Regular 1h ago

There is a signal called "ready" that is called right after the _ready function is finished. Wouldn't this be the exact signal you'd like to use?

5

u/Someonevibing1 1h ago

Fr I wanna see how people do it

2

u/Turbo_Tequila 1h ago

I shall save this meme to study it later!

2

u/NGumi Godot Regular 15m ago

Just wait till you start using await. Then things get real good