Godot Version
Godot Engine 4
Question
So, I was creating a upgrade controller for my clicker game, and I have a pause in the script OS.delay_msec()
it waits for one second before running adding points (Almost like an auto clicker), but here it pauses everything, I can’t click in the one second it delays. If someone could help me, that would be great!
Code
extends Control
@export var LABEL : Label
@export var MULTIPLIER : int = 0
@export var POINTS : int = 0
@export var AUTO_CLICKERS : int = 0
func add_points():
POINTS += 1 + MULTIPLIER
func auto_click():
if AUTO_CLICKERS > 0:
OS.delay_msec(1000)
POINTS += AUTO_CLICKERS
func update_label():
LABEL.text = "Points: %s" % POINTS
func _ready():
pass
func _process(_delta):
update_label()
auto_click()
func _on_clicker_pressed():
add_points()