Skip to content

Commit c366c30

Browse files
committed
added ability to set rock index
1 parent 708fb42 commit c366c30

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

godot/lunasim/rocks/rock.gd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ const CHOICES: Array[PackedScene] = [
1919
preload("res://rocks/Low_Poly_Rock_Small_004.glb")
2020
]
2121

22+
@export var index := -1
23+
2224

2325
func _ready() -> void:
2426
for _i in range(12):
2527
await get_tree().physics_frame
2628

27-
var rock: Node = CHOICES.pick_random().instantiate()
29+
var rock: Node
30+
if index == -1:
31+
rock = CHOICES.pick_random().instantiate()
32+
else:
33+
rock = CHOICES[index].instantiate()
2834
rock.get_child(0).get_child(0).collision_layer = 16
2935
rotation.y = randf() * TAU
3036
rock.scale *= randf_range(1.0, 1.5)

0 commit comments

Comments
 (0)