在测试了其他一些引擎之后,我在游戏开发学习过程中选择了 Godot,并且非常欣赏 GDScript 的简洁性、节点/继承结构以及信号覆盖观察者事件的方式。我一直通过各种教程和阅读文档来积累知识。
不知何故,我正在努力解决检测精灵上的鼠标点击这一非常基本的任务。(嗯,在精灵的父节点上,要么是 Node2D,要么是 Area2D。)
我的过程是这样的:
func _on_logo_input_event(viewport, event, shape_idx):
if (event is InputEventMouseButton && event.pressed):
print("Logo clicked")
Run Code Online (Sandbox Code Playgroud)
当我运行游戏时,单击后我没有得到任何输出,并看到以下错误:
The argument 'viewport' is never used in the function '_on_logo_input_event'. If this is intended, prefix it with an underscore: '_viewport'
The argument 'shape_idx' is never used in the function '_on_logo_input_event'. If this …