buckshotroulette-decomp/TextShaker.gd

25 lines
550 B
GDScript3
Raw Normal View History

2024-01-20 12:17:43 +00:00
class_name TextShaker extends Node
@export var delay : float
@export var offset1 : float
@export var offset2 : float
@export var text : Control
var looping = false
var origpos
func _ready():
origpos = text.position
looping = true
Shake()
func Shake():
while(looping):
var randx = randf_range(offset1, offset2)
var randy = randf_range(offset1, offset2)
text.position = Vector2(randx, randy)
await get_tree().create_timer(delay, false).timeout
text.position = origpos
await get_tree().create_timer(delay, false).timeout
pass
pass