Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | daniel500013 |
Hi, I want to create a script in which when I am in the selected position, my door will open, and after leaving this area the door was closed, so I tried to do it using area2d, but when my character enters my area, I have an error like in title and someone can tell me how to fix it?
Script
Texture green_line = (Texture)ResourceLoader.Load("res://Ship/Ship_Elements/Textures/greenLine.png");
Texture red_line = (Texture)ResourceLoader.Load("res://Ship/Ship_Elements/Textures/redLine.png");
private void _on_enter_area_body_entered(object body)
{
CollisionShape2D line_collider = GetNode<CollisionShape2D>("StaticBody2D/CollisionShape2D");
Sprite line = GetNode<Sprite>("Sprite");
line.Texture = green_line;
line_collider.Disabled = true;
}