Toshusai blog

知識の保管庫

Godot Engine

【Godot】Dictionaryでforループ

for key in dict.keys(): print(dict[key]) キーを取得しなくても要素はキーになる for key in dict: print(dict[key]) キーを使わないなら for value in dict.values(): print(value) Ref docs.godotengine.org docs.godotengine.org

【Godot】子ノードを他の親に移動する

以下のようにやるとnode already has a parentというエラーがでる parent.add_child(node) 一度子ノードを除いてから別の親に追加すれば移動できる if child.get_parent() != null: child.get_parent().remove_child(child) parent.add_child(child) 参考 go…

【Godot】MenuButtonの使い方

Windowsのアプリの左上にあるようなメニューを作るためのノード PopupMenuをラップしているのだが、エディタからではアイテムを設定できない。 get_popup()からPopupMenuを取得して設定する必要がある。 例 var pop_up = event_menu_button.get_popup() pop_…