24 lines
760 B
GDScript
24 lines
760 B
GDScript
extends MarginContainer
|
|
@onready var reduce: BaseControl = %Reduce
|
|
@onready var increase: BaseControl = %Increase
|
|
@onready var speedometer: TextureProgressBar = $Speedometer
|
|
@onready var throttle_position_label: BaseControl = %ThrottlePositionLabel
|
|
@onready var gear_texture_rect: BaseControl = $Speedometer/GearTextureRect
|
|
|
|
func _ready() -> void:
|
|
ReviseThrottle(0)
|
|
reduce.on_click.connect(func(node):
|
|
ReviseThrottle(-1)
|
|
)
|
|
increase.on_click.connect(func(node):
|
|
ReviseThrottle(1)
|
|
)
|
|
pass # Replace with function body.
|
|
|
|
func ReviseThrottle(value):
|
|
speedometer._value += value
|
|
speedometer._value = clampi(speedometer._value,0,30)
|
|
throttle_position_label.onScale()
|
|
gear_texture_rect.onScale()
|
|
throttle_position_label.text = str(speedometer._value)
|