touilleMan / godot-python

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

How can I use emit_signal()? #343

Open MarioMey opened 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...?

cridenour commented 2 years ago

https://github.com/touilleMan/godot-python/issues/199#issuecomment-750354045