22 lines
392 B
GDScript
22 lines
392 B
GDScript
extends Button
|
|
|
|
|
|
@onready var dice_label_one = get_node("../DiceLabelOne")
|
|
var dice_print_value = 0
|
|
var rng = RandomNumberGenerator.new()
|
|
|
|
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
func roll_die(dice, sides):
|
|
while dice >= 1:
|
|
dice_print_value = rng.randi_range(1, sides)
|
|
dice -= 1
|
|
|
|
|
|
func _on_ButtonRoll_pressed():
|
|
roll_die(1, 6)
|
|
dice_label_one.text = str(dice_print_value)
|