fixing void card

This commit is contained in:
betalars 2023-07-12 18:47:31 +02:00
parent 350ba65a08
commit fc85ba656b
1 changed files with 5 additions and 4 deletions

View File

@ -15,13 +15,13 @@ var on_stage = false
@export var text: String = "" : @export var text: String = "" :
set(value): set(value):
text = value text = value
if is_inside_tree() or Engine.is_editor_hint(): if get_children() != [] or Engine.is_editor_hint():
$Label.text = value $Label.text = value
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation) $BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
if is_inside_tree() and !Engine.is_editor_hint(): if !Engine.is_editor_hint():
wiggle_pos = float(text.hash() % 100) wiggle_pos = float(text.hash() % 100)
_handle_wiggle(0) _handle_wiggle(0)
if is_inside_tree() and value == "": if get_children() != [] and !Engine.is_editor_hint() and text == "":
$BackgroundSprite.void_active = true $BackgroundSprite.void_active = true
@export var wiggle_strength: float = 0.2 @export var wiggle_strength: float = 0.2
@export var wiggle_speed: float = 5 @export var wiggle_speed: float = 5
@ -76,6 +76,7 @@ func _ready():
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation) $BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
$Label.text = self.text $Label.text = self.text
if not Engine.is_editor_hint(): $BackgroundSprite.void_active = text == ""
wiggle_pos = float(text.hash() % 100) wiggle_pos = float(text.hash() % 100)
if not Engine.is_editor_hint(): if not Engine.is_editor_hint():