extends StaticBody2D class_name DoorStaticBody2D onready var door_sprite : DoorSprite = get_parent() func on_player_touched(): match door_sprite.door_type: DoorSprite.DoorType.Yellow: if GameArchiveManager.player_info.yellow_key <= 0: return GameArchiveManager.player_info.yellow_key -= 1 $"/root/Main/UI/KeyBackground/YellowKeyCountLabel".text = GameArchiveManager.player_info.yellow_key as String DoorSprite.DoorType.Blue: if GameArchiveManager.player_info.blue_key <= 0: return GameArchiveManager.player_info.blue_key -= 1 $"/root/Main/UI/KeyBackground/BlueKeyCountLabel".text = GameArchiveManager.player_info.blue_key as String DoorSprite.DoorType.Red: if GameArchiveManager.player_info.red_key <= 0: return GameArchiveManager.player_info.red_key -= 1 $"/root/Main/UI/KeyBackground/RedKeyCountLabel".text = GameArchiveManager.player_info.red_key as String door_sprite.queue_free() AffectAudioPlayer.play_door() GameArchiveManager.add_used_item(door_sprite.get_path())