mirror of
https://github.com/Steffo99/looping-for-loops.git
synced 2024-11-22 16:14:22 +00:00
22 lines
487 B
GDScript3
22 lines
487 B
GDScript3
|
extends Node2D
|
||
|
|
||
|
|
||
|
var rng = RandomNumberGenerator.new()
|
||
|
|
||
|
var cb_speed: float setget set_cb_speed, get_cb_speed
|
||
|
var randomize_start_position: bool = false
|
||
|
|
||
|
func set_cb_speed(value):
|
||
|
cb_speed = value
|
||
|
$AnimationPlayer.playback_speed = -value / 80
|
||
|
$AnimationPlayer.play("SpinClockwise")
|
||
|
if randomize_start_position:
|
||
|
rng.randomize()
|
||
|
var offset = rng.randf_range(0.0, 1.0)
|
||
|
$AnimationPlayer.seek(offset, true)
|
||
|
randomize_start_position = false
|
||
|
|
||
|
func get_cb_speed():
|
||
|
return cb_speed
|
||
|
|