Cow_Life_Sim_RPG/MiniGames/RingToss/AimBar.gd

42 lines
608 B
GDScript

extends ProgressBar
@export var Speed = 60
var dir = 1
var Power = 1
var active = true
var my_timer = Timer.new()
# Called when the node enters the scene tree for the first time.
func _ready():
add_child(my_timer)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if not active:
return
Power += Speed * delta * dir
if Power >= 100:
dir = -1
elif Power <= 0:
dir = 1
self.value = Power
func _on_button_pressed():
active = false
$Button.disabled = true
$Button.visible = false
$PowBar.visible = true
$PowBar.active = true