start changing player script to use group paradigm

This commit is contained in:
betalars 2023-05-28 01:43:52 +02:00
parent 52da9f7cfc
commit 79d4f75b50
1 changed files with 3 additions and 2 deletions

View File

@ -2,19 +2,20 @@
extends Control extends Control
class_name Card class_name Card
var compatible_postits: Array[PostIt] = []
var own_postits: Array[PostIt] = []
@export var text: String = "" : @export var text: String = "" :
set (value): set (value):
if is_inside_tree() or Engine.is_editor_hint(): if is_inside_tree() or Engine.is_editor_hint():
$Label.text = value $Label.text = value
text = value text = value
@export var compatible_postits: Array[PostIt] = []
@export var voice_line: AudioStream = null @export var voice_line: AudioStream = null
func _ready(): func _ready():
if not Engine.is_editor_hint() and is_inside_tree(): if not Engine.is_editor_hint() and is_inside_tree():
for postit in self.get_children(false): for postit in self.get_children(false):
self.compatible_postits.append(postit as PostIt) self.own_postits.append(postit as PostIt)
$BackgroundSprite.frame = randi() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation) $BackgroundSprite.frame = randi() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
$Label.text = self.text $Label.text = self.text