randomize bottle

This commit is contained in:
Mikhail Aristov 2024-01-28 14:57:01 +01:00
parent 1ffe5c688c
commit c9c280491f
1 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,12 @@ var is_hidding: bool
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
tim_global_position = get_node("/root/IngameScene/Stage/Tim/ThrowPoint").global_position tim_global_position = get_node("/root/IngameScene/Stage/Tim/ThrowPoint").global_position
tim_global_position += _random_inside_unit_circle() * 23
rotation_degrees += randf() * 360
func _random_inside_unit_circle() -> Vector2:
var theta : float = randf() * 2 * PI
return Vector2(cos(theta), sin(theta)) * sqrt(randf())
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):