1bit-game-jam/scripts/entities/Door.cs
2023-08-19 15:23:08 +03:00

27 lines
535 B
C#

using Godot;
public partial class Door : Node2D
{
private AnimatedSprite2D _animatedSprite2D;
private CollisionShape2D _collisionShape2D;
public override void _Ready()
{
_animatedSprite2D = (AnimatedSprite2D)FindChild("AnimatedSprite2D");
_collisionShape2D = (CollisionShape2D)FindChild("CollisionShape2D");
Close();
}
public void Close()
{
_animatedSprite2D.Play("close");
_collisionShape2D.Disabled = false;
}
public void Open()
{
_animatedSprite2D.Play("open");
_collisionShape2D.Disabled = true;
}
}