英文:
indentifier not declared... but im declaring it now?
问题
func _physics_process(delta):
climbing()
脚本编辑器显示:
"climbing" 方法未声明,等等...
就像我现在正在声明它一样...你想要什么,Godot?你寻求什么?
我在 func _physics_process(delta) 下声明了几十个东西,然后我尝试实现爬升系统的升级... 突然间,Godot 决定不再让我这样做。
我甚至不知道我做错了什么,因为我一步一步地按照教程操作...
英文:
func _physics_process(delta):
climbing()
the script editor says:
"the method climbing isn't declared yada yada..
like I'm literally declaring it now...what do you want from godot? what is it that you seek?
I have declared a few dozen things under func _physics_process(delta), then i tried implementing an upgrade for the climbing system... and suddenly godot decided to not let me do it anymore.
I don't even know what am I doing wrong as I'm following a tutorial step by step...
答案1
得分: 1
根据您提供的代码:不,您现在不是在字面上声明 climbing()
,您只是在调用它。
您需要:
func _physics_process(delta):
climbing()
func climbing():
[在此处放置代码]
如果 climbing
是在其他脚本中声明的,您需要引用附加到脚本的对象,例如,如果 spiderman
是当前节点的子节点,则需要 $spiderman.climbing()
。
英文:
Based on the code you provided: no, you are not literally declaring climbing()
now, you are only calling it.
You need:
func _physics_process(delta):
climbing()
func climbing():
[code goes here]
If climbing
was declared in some other script, you need to reference the object the script is attached to, eg $spiderman.climbing()
if spiderman
is a child node of the current node.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论