From 5caf5f6c71b21976e2aaccf573180cb8477860ca Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 13 Feb 2024 16:45:38 +0100 Subject: [PATCH] Added new trees --- client/Main.tscn | 13 ++++++++----- client/item/Item.gd | 3 ++- client/item/soul/Soul.gd | 16 ++++++++-------- client/world/trees/Sapling.tscn | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 client/world/trees/Sapling.tscn diff --git a/client/Main.tscn b/client/Main.tscn index 7b15b13..68b50a3 100644 --- a/client/Main.tscn +++ b/client/Main.tscn @@ -14,13 +14,13 @@ [ext_resource type="Script" path="res://world/Sun.gd" id="11_4jb08"] [ext_resource type="PackedScene" uid="uid://cpdoq0oh84mfw" path="res://camera/Camera.tscn" id="12_aljdh"] [ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="12_cscto"] -[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://assets/tree/Tree.blend" id="14_7jtdl"] [ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="15_hgl78"] [ext_resource type="Script" path="res://world/PlayerManager.gd" id="16_dp6bj"] [ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="17_43qhq"] [ext_resource type="Material" uid="uid://bdsblfaxbipaa" path="res://world/grass/GrassMaterial.tres" id="18_tja64"] [ext_resource type="MultiMesh" uid="uid://dog5aq5n2q025" path="res://assets/grass/grass.multimesh" id="19_ae26a"] [ext_resource type="PackedScene" uid="uid://cm0rho6adv2p7" path="res://world/water/Water.tscn" id="20_bmo3k"] +[ext_resource type="PackedScene" uid="uid://cuuwwdce1u8n8" path="res://world/trees/Sapling.tscn" id="22_5yt7w"] [ext_resource type="PackedScene" uid="uid://b0w38xjifulq6" path="res://assets/house/House.blend" id="23_5j7b3"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_he5c5"] @@ -107,11 +107,14 @@ script = ExtResource("11_4jb08") [node name="Trees" type="Node3D" parent="World"] -[node name="Tree" parent="World/Trees" instance=ExtResource("14_7jtdl")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.11323, 0, -7.57074) +[node name="Sapling" parent="World/Trees" instance=ExtResource("22_5yt7w")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.3131, 0, 4.6593) -[node name="Tree2" parent="World/Trees" instance=ExtResource("14_7jtdl")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.11323, 0, 7.80548) +[node name="Sapling2" parent="World/Trees" instance=ExtResource("22_5yt7w")] +transform = Transform3D(0.484611, 0, -0.87473, 0, 1, 0, 0.87473, 0, 0.484611, 9.26825, 0, -9.34497) + +[node name="Sapling3" parent="World/Trees" instance=ExtResource("22_5yt7w")] +transform = Transform3D(0.398509, 0, 0.917164, 0, 1, 0, -0.917164, 0, 0.398509, 7.91727, 0, 8.5787) [node name="Enemies" type="Node3D" parent="World"] diff --git a/client/item/Item.gd b/client/item/Item.gd index a487865..b94631c 100644 --- a/client/item/Item.gd +++ b/client/item/Item.gd @@ -2,4 +2,5 @@ class_name Item extends Resource @export var name: String -@export var scene: PackedScene \ No newline at end of file +@export var scene: PackedScene +@export var icon: Texture2D \ No newline at end of file diff --git a/client/item/soul/Soul.gd b/client/item/soul/Soul.gd index bc833e0..70f67fe 100644 --- a/client/item/soul/Soul.gd +++ b/client/item/soul/Soul.gd @@ -1,5 +1,7 @@ extends Node3D +@export var tween_duration := 0.5 + var particles: GPUParticles3D var trails: GPUParticles3D var attractor: GPUParticlesAttractor3D @@ -29,15 +31,13 @@ func on_body_entered(body: Node3D): attractor.visible = false area.set_deferred("monitoring", false) particles.process_material.attractor_interaction_enabled = true - var duration := 0.5 - + var tween = get_tree().create_tween() - tween.parallel().tween_property(particles, "amount_ratio", 0, duration) - # tween.parallel().tween_property(trails, "amount_ratio", 0, duration) - tween.parallel().tween_property(light, "light_energy", 0, duration) - tween.parallel().tween_property(sprite, "scale", Vector3.ZERO, duration) - tween.parallel().tween_property(sprite, "material_override:albedo_color", Color(0, 0, 0, 0), duration) + tween.parallel().tween_property(particles, "amount_ratio", 0, tween_duration) + # tween.parallel().tween_property(trails, "amount_ratio", 0, tween_duration) + tween.parallel().tween_property(light, "light_energy", 0, tween_duration) + tween.parallel().tween_property(sprite, "scale", Vector3.ZERO, tween_duration) + tween.parallel().tween_property(sprite, "material_override:albedo_color", Color(0, 0, 0, 0), tween_duration) await tween.finished await get_tree().create_timer(2.0).timeout queue_free() - # tween.tween_callback(queue_free) diff --git a/client/world/trees/Sapling.tscn b/client/world/trees/Sapling.tscn new file mode 100644 index 0000000..712568d --- /dev/null +++ b/client/world/trees/Sapling.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=3 format=3 uid="uid://cuuwwdce1u8n8"] + +[ext_resource type="PackedScene" uid="uid://ctsrv1aeqj0h" path="res://assets/tree/Sapling.blend" id="1_lb0yq"] + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_qu7ax"] +height = 1.5 +radius = 0.25 + +[node name="Sapling" instance=ExtResource("1_lb0yq")] + +[node name="tree" parent="." index="0"] +layers = 4 + +[node name="StaticBody3D" type="StaticBody3D" parent="." index="1"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 0) +shape = SubResource("CylinderShape3D_qu7ax")