0 votes

Once again, good day to all. I played around with the code a bit and noticed an interesting feature, namely, this code fragment detects an anode from another scene, but does not interact with it. What do you think could be wrong? But if you specify the path to the object directly on the general scene, then everything is fine, but this approach is not necessary in this case. Since the duplicated scenes only work with one scene, that is, " spike "will work, but" Space2"," Space3", " ... " will not. Therefore, here the approach is to immediately get a collision from the loaded scene. The main question is this. Why is the collision detected (There are no errors in the console), but does not interact with it?


var LoadSceneSpike_object = Godot.ResourceLoader.Load<PackedScene>("res://Core/Scenes/Spike.tscn");

var SpikeScene_object_loaded = LoadSceneSpike_object.Instance();

var CollisionSpike_Damage = SpikeScene_object_loaded.GetNode<KinematicBody2D>("Spike_body");

if (collision.Collider == CollisionSpike_Damage)
  hp = hp - 50;
Godot version 3.2.3 Stable
in Engine by (147 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.