touilleMan / godot-python

Python support for Godot 🐍🐍🐍
Other
1.83k stars 136 forks source link

How can I use emit_signal()? #342

Closed MarioMey closed 2 years ago

MarioMey commented 2 years ago

I'm testing godot-python by converting the first tutorial from Godot Docs "Dodge the Creeps 2D", all GDScript files to Python.

I don't find emit_signal(), I can't import from godot or as attribute of any object, for example; CanvasLayer. I get

AttributeError: 'HUD' object has no attribute 'emit_signal'

When creating a signal, it stays there as a <class 'godot.tags.SignalField'>, but I can't do anything with it.

I found in examples/pong/pong.py that there's game_finished = signal() but code never emit that signal. Is it imposible?

Any solution to this? Maybe by not using signals, but some kind of python messages between nodes...?

Also, when I create start_game = signal() in HUD.py, unlike pong.py, that signal doesn't appear in Node Signals panel... and I don't know why.

MarioMey commented 2 years ago

When I click in "Comment", it took me to a 404. So, I open a new one: #343