Skip to content

Commit

Permalink
added ability to set rock index
Browse files Browse the repository at this point in the history
  • Loading branch information
manglemix committed Jan 30, 2025
1 parent 708fb42 commit c366c30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion godot/lunasim/rocks/rock.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ const CHOICES: Array[PackedScene] = [
preload("res://rocks/Low_Poly_Rock_Small_004.glb")
]

@export var index := -1


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

var rock: Node = CHOICES.pick_random().instantiate()
var rock: Node
if index == -1:
rock = CHOICES.pick_random().instantiate()
else:
rock = CHOICES[index].instantiate()
rock.get_child(0).get_child(0).collision_layer = 16
rotation.y = randf() * TAU
rock.scale *= randf_range(1.0, 1.5)
Expand Down

0 comments on commit c366c30

Please sign in to comment.