mirror of
https://github.com/Steffo99/pineapple-surf.git
synced 2024-11-25 01:04:18 +00:00
Fix pineapple magnet
This commit is contained in:
parent
c9d4df4a86
commit
69384f9555
3 changed files with 11 additions and 4 deletions
|
@ -82,16 +82,20 @@ transform = Transform3D(1, 0, 0, 0, -0.337161, 0.941447, 0, -0.941447, -0.337161
|
||||||
[node name="Player" parent="." instance=ExtResource("3_5378m")]
|
[node name="Player" parent="." instance=ExtResource("3_5378m")]
|
||||||
transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 0, 4.89631, 0)
|
transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 0, 4.89631, 0)
|
||||||
|
|
||||||
[node name="CropTile" parent="." instance=ExtResource("8_4ooup")]
|
[node name="CropTiles" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
[node name="CropTile" parent="CropTiles" instance=ExtResource("8_4ooup")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, 8)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, 8)
|
||||||
debug_growth = true
|
debug_growth = true
|
||||||
|
|
||||||
[node name="CropTile2" parent="." instance=ExtResource("8_4ooup")]
|
[node name="CropTile2" parent="CropTiles" instance=ExtResource("8_4ooup")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 8)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 8)
|
||||||
debug_growth = true
|
debug_growth = true
|
||||||
debug_growth_offset = 0.5
|
debug_growth_offset = 0.5
|
||||||
|
|
||||||
[node name="CropTile3" parent="." instance=ExtResource("8_4ooup")]
|
[node name="CropTile3" parent="CropTiles" instance=ExtResource("8_4ooup")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 8)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 8)
|
||||||
debug_growth = true
|
debug_growth = true
|
||||||
debug_growth_offset = 0.6
|
debug_growth_offset = 0.6
|
||||||
|
|
||||||
|
[node name="Produce" type="Node3D" parent="."]
|
||||||
|
|
|
@ -13,6 +13,7 @@ radius = 3.0
|
||||||
|
|
||||||
[node name="Pineapple" type="RigidBody3D"]
|
[node name="Pineapple" type="RigidBody3D"]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
|
collision_mask = 3
|
||||||
lock_rotation = true
|
lock_rotation = true
|
||||||
linear_damp = 1.0
|
linear_damp = 1.0
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ extends Node3D
|
||||||
|
|
||||||
@export var produce_scene: PackedScene = preload("res://island/Pineapple.tscn")
|
@export var produce_scene: PackedScene = preload("res://island/Pineapple.tscn")
|
||||||
|
|
||||||
|
@onready var produce_container: Node3D = get_tree().root.find_child("Produce", true, false)
|
||||||
var rng: RandomNumberGenerator
|
var rng: RandomNumberGenerator
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,5 +15,6 @@ func _ready():
|
||||||
func produce_with_random_force():
|
func produce_with_random_force():
|
||||||
# TODO: Not sure it's a good idea attaching produce to the crop
|
# TODO: Not sure it's a good idea attaching produce to the crop
|
||||||
var produce: RigidBody3D = produce_scene.instantiate()
|
var produce: RigidBody3D = produce_scene.instantiate()
|
||||||
add_child(produce)
|
produce.position = global_position
|
||||||
|
produce_container.add_child(produce)
|
||||||
produce.apply_impulse(Vector3.UP * rng.randf_range(15.0, 25.0))
|
produce.apply_impulse(Vector3.UP * rng.randf_range(15.0, 25.0))
|
||||||
|
|
Loading…
Reference in a new issue