1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-23 00:04:20 +00:00
pineapple-surf/island/Producer.gd

21 lines
586 B
GDScript3
Raw Normal View History

2023-01-08 09:01:13 +00:00
extends Node3D
@export var produce_scene: PackedScene = preload("res://island/Pineapple.tscn")
2023-01-08 09:20:01 +00:00
@onready var produce_container: Node3D = get_tree().root.find_child("Produce", true, false)
2023-01-08 09:01:13 +00:00
var rng: RandomNumberGenerator
func _ready():
rng = RandomNumberGenerator.new()
rng.randomize()
func produce_with_random_force():
# TODO: Not sure it's a good idea attaching produce to the crop
var produce: RigidBody3D = produce_scene.instantiate()
2023-01-08 09:20:01 +00:00
produce.position = global_position
produce_container.add_child(produce)
2023-01-08 09:01:13 +00:00
produce.apply_impulse(Vector3.UP * rng.randf_range(15.0, 25.0))