Added dice

This commit is contained in:
Donato Mastronardi
2026-02-28 16:42:08 +01:00
parent ecc5f08299
commit dbf1788069
4 changed files with 31 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ animations = [{
"speed": 5.0
}, {
"frames": [{
"duration": 0.4,
"duration": 1.9,
"texture": ExtResource("1_288jf")
}, {
"duration": 1.0,
@@ -84,8 +84,8 @@ animations = [{
[node name="Dice" type="Node2D" unique_id=668450548]
script = ExtResource("1_x6ve6")
roll_time = null
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=78541616]
sprite_frames = SubResource("SpriteFrames_yynlm")
animation = &"6"
animation = &"rolling"
frame_progress = 0.8785853

View File

@@ -13,10 +13,9 @@ func roll_dice():
if is_rolling:
return
is_rolling = true
sprite.play('rolling')
await get_tree().create_timer(roll_time).timeout
self.random_value = int(randi_range(0, 7))
self.random_value = randi_range(1, 6)
sprite.play(str(self.random_value))
is_rolling = false
func _process(delta):