Quit-Rolling-Around-gmtk-ja.../UI/Dice.gd

17 lines
344 B
GDScript3
Raw Normal View History

2022-07-16 21:33:47 +01:00
tool
extends Control
const dice_image_string = "res://Assets/Dice/Dice%s.png"
export (int, 1, 6) var dice_value : int setget _set_dice_value
func _set_dice_value(new_value):
dice_value = new_value
self.texture = load(dice_image_string % new_value)
func _ready():
randomize()
2022-07-16 22:58:24 +01:00
self.dice_value = int(round(rand_range(0.5, 6.49999999)))