【问题标题】:Can someone translate this Godot 2 code to Godot 3?有人可以将此Godot 2代码翻译成Godot 3吗?
【发布时间】:2019-08-29 01:38:05
【问题描述】:
if is_colliding():
   var normal = getcollisionnormal()
   var object = get_collider()
   var objectParent = object.get_parent()
   if normal == Vector2(0, 1):
      objectParent.queue_free()`

如果有帮助,我正在使用 move_and_slide 移动。

【问题讨论】:

  • 你试过谷歌翻译吗!? :P 抱歉,StackOverflow 不适合翻译代码。这看起来很简单,查看每个方法调用,看看它是否改变了。

标签: godot gdscript


【解决方案1】:

最新的物理信息(包括碰撞)可以在这里找到: https://docs.godotengine.org/en/3.1/tutorials/physics/physics_introduction.html

节点的文档在这里:https://docs.godotengine.org/en/3.1/classes/class_node.html

显然 get_parent() 是不可取的。其他人在这里遇到了类似的问题: https://godotengine.org/qa/9459/how-to-call-a-special-func-from-another-node-above

【讨论】:

    猜你喜欢
    • 2018-11-29
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 2016-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多