changing random rotation offset to depend on card text
This commit is contained in:
parent
155ee333b1
commit
8859f2e23f
|
|
@ -4,7 +4,7 @@ extends Area2D
|
||||||
class_name Card
|
class_name Card
|
||||||
var compatible_postits: Array[PostIt] = []
|
var compatible_postits: Array[PostIt] = []
|
||||||
var own_postits: Array[PostIt] = []
|
var own_postits: Array[PostIt] = []
|
||||||
var wiggle_pos: float = randf_range(-100, 100)
|
var wiggle_pos: float = 0
|
||||||
var wiggle_intensity: float = 0
|
var wiggle_intensity: float = 0
|
||||||
var noise: Noise = FastNoiseLite.new()
|
var noise: Noise = FastNoiseLite.new()
|
||||||
var wiggle_tween
|
var wiggle_tween
|
||||||
|
|
@ -16,8 +16,10 @@ var scale_tween
|
||||||
if is_inside_tree() or Engine.is_editor_hint():
|
if is_inside_tree() 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():
|
wiggle_pos = float(text.hash() % 100)
|
||||||
$BackgroundSprite.void_active = value == ""
|
if is_inside_tree() and value == "":
|
||||||
|
$BackgroundSprite.void_active = true
|
||||||
|
_handle_wiggle(0)
|
||||||
@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
|
||||||
@export_range(1, 2) var scale_bump: float = 1.05
|
@export_range(1, 2) var scale_bump: float = 1.05
|
||||||
|
|
@ -50,7 +52,7 @@ var scale_tween
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
_handle_wiggle(0)
|
|
||||||
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():
|
for postit in self.get_children():
|
||||||
if postit is PostIt: self.own_postits.append(postit as PostIt)
|
if postit is PostIt: self.own_postits.append(postit as PostIt)
|
||||||
|
|
@ -64,9 +66,12 @@ func _ready():
|
||||||
own_postits[0].sibling = own_postits[1]
|
own_postits[0].sibling = own_postits[1]
|
||||||
own_postits[1].sibling = own_postits[0]
|
own_postits[1].sibling = own_postits[0]
|
||||||
|
|
||||||
$BackgroundSprite.frame = randi() % $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
|
||||||
|
|
||||||
|
wiggle_pos = float(text.hash() % 100)
|
||||||
|
_handle_wiggle(0)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
|
||||||
if highlighted:
|
if highlighted:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue