Added dice
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -11,9 +11,16 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="Yatzee"
|
||||
run/main_scene="uid://cyn24hcp4husv"
|
||||
config/features=PackedStringArray("4.6", "Mobile")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/aspect="keep_width"
|
||||
window/handheld/orientation=1
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
|
||||
18
yatzee.tscn
18
yatzee.tscn
@@ -1,3 +1,21 @@
|
||||
[gd_scene format=3 uid="uid://cyn24hcp4husv"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cp21p38e4565f" path="res://Dice/Dice.tscn" id="1_edqef"]
|
||||
|
||||
[node name="Node2D" type="Node2D" unique_id=854480139]
|
||||
position = Vector2(160.00002, 608)
|
||||
scale = Vector2(0.124579296, 0.12574217)
|
||||
|
||||
[node name="DiceA" parent="." unique_id=668450548 instance=ExtResource("1_edqef")]
|
||||
|
||||
[node name="DiceB" parent="." unique_id=21685598 instance=ExtResource("1_edqef")]
|
||||
position = Vector2(512, 0)
|
||||
|
||||
[node name="DiceC" parent="." unique_id=1101531542 instance=ExtResource("1_edqef")]
|
||||
position = Vector2(1024, 0)
|
||||
|
||||
[node name="DiceD" parent="." unique_id=390051398 instance=ExtResource("1_edqef")]
|
||||
position = Vector2(1536, 0)
|
||||
|
||||
[node name="DiceE" parent="." unique_id=360699046 instance=ExtResource("1_edqef")]
|
||||
position = Vector2(2048, 0)
|
||||
|
||||
Reference in New Issue
Block a user