using Godot; public partial class Door : Node2D { private AnimatedSprite2D _animatedSprite2D; private StaticBody2D _staticBody2D; private uint _collisionMask; private uint _collisionLayer; public override void _Ready() { _animatedSprite2D = (AnimatedSprite2D)FindChild("AnimatedSprite2D"); _staticBody2D = (StaticBody2D)FindChild("StaticBody2D"); _collisionMask = _staticBody2D.CollisionMask; _collisionLayer = _staticBody2D.CollisionLayer; Close(); } public void Close() { _animatedSprite2D.Play("close"); _staticBody2D.CollisionMask = _collisionMask; _staticBody2D.CollisionLayer = _collisionLayer; } public void Open() { _animatedSprite2D.Play("open"); _staticBody2D.CollisionMask = 0; _staticBody2D.CollisionLayer = 0; } }