Added soul collection

This commit is contained in:
2024-02-12 09:53:15 +01:00
parent 9ceaa3c649
commit 996cb7b6fd
5 changed files with 155 additions and 78 deletions

43
client/item/soul/Soul.gd Normal file
View File

@ -0,0 +1,43 @@
extends Node3D
var particles: GPUParticles3D
var trails: GPUParticles3D
var attractor: GPUParticlesAttractor3D
var light: Light3D
var sprite: Sprite3D
var area: Area3D
var collected_by: Player
func _ready():
particles = %Particles
trails = %Trail
light = %Light
sprite = %Sprite
area = %Area
attractor = %Attractor
func _process(delta):
if !collected_by:
return
position = lerp(position, Global.player.position + Vector3.UP, 1.0 * delta)
func on_body_entered(body: Node3D):
if body is Player:
collected_by = body
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)
await tween.finished
await get_tree().create_timer(2.0).timeout
queue_free()
# tween.tween_callback(queue_free)

View File

@ -1,33 +1,32 @@
[gd_scene load_steps=7 format=3 uid="uid://dl4vcp04t8iyr"]
[gd_scene load_steps=13 format=3 uid="uid://dl4vcp04t8iyr"]
[ext_resource type="Texture2D" uid="uid://cdoxs0s8xh1b3" path="res://particle/FadeOut.tres" id="1_dd0n2"]
[ext_resource type="Texture2D" uid="uid://c3wx3cgn8x62m" path="res://assets/particles/particles-single.png" id="1_hhudy"]
[sub_resource type="Curve" id="Curve_dga57"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -1.66657, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_mxji2"]
curve = SubResource("Curve_dga57")
[ext_resource type="Script" path="res://item/soul/Soul.gd" id="1_mm7cb"]
[ext_resource type="Texture2D" uid="uid://cfkwtmj6tc3wa" path="res://item/soul/color_ramp.tres" id="3_ibw0j"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_uyeuh"]
emission_shape = 1
emission_sphere_radius = 0.25
lifetime_randomness = 0.15
spread = 180.0
initial_velocity_min = 0.1
initial_velocity_max = 1.0
gravity = Vector3(0, 0, 0)
radial_accel_min = -0.5
radial_accel_max = -0.25
tangential_accel_min = 0.25
tangential_accel_max = 0.5
tangential_accel_min = -3.0
tangential_accel_max = 3.0
scale_min = 0.1
scale_max = 0.2
color = Color(1, 0.713726, 0.862745, 1)
alpha_curve = SubResource("CurveTexture_mxji2")
scale_max = 0.5
color_ramp = ExtResource("3_ibw0j")
alpha_curve = ExtResource("1_dd0n2")
hue_variation_min = -0.03
hue_variation_max = 0.03
turbulence_noise_speed = Vector3(0.5, 0.5, 0.5)
sub_emitter_mode = 1
sub_emitter_frequency = 50.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gl2xl"]
transparency = 1
blend_mode = 1
cull_mode = 2
shading_mode = 0
specular_mode = 2
vertex_color_use_as_albedo = true
albedo_texture = ExtResource("1_hhudy")
disable_receive_shadows = true
@ -36,13 +35,82 @@ disable_receive_shadows = true
material = SubResource("StandardMaterial3D_gl2xl")
size = Vector2(0.1, 0.1)
[node name="Soul" type="Node3D"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_l1npq"]
lifetime_randomness = 0.05
gravity = Vector3(0, 0, 0)
attractor_interaction_enabled = false
scale_min = 0.4
scale_max = 0.4
scale_curve = ExtResource("1_dd0n2")
color_ramp = ExtResource("3_ibw0j")
alpha_curve = ExtResource("1_dd0n2")
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pk2ln"]
transparency = 1
blend_mode = 1
cull_mode = 2
vertex_color_use_as_albedo = true
albedo_texture = ExtResource("1_hhudy")
[sub_resource type="QuadMesh" id="QuadMesh_pthhm"]
material = SubResource("StandardMaterial3D_pk2ln")
size = Vector2(0.1, 0.1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ociyh"]
resource_local_to_scene = true
transparency = 1
blend_mode = 1
albedo_color = Color(0, 0.501961, 3, 1)
albedo_texture = ExtResource("1_hhudy")
billboard_mode = 1
billboard_keep_scale = true
[sub_resource type="SphereShape3D" id="SphereShape3D_rytrf"]
radius = 1.5
[node name="Soul" type="Node3D"]
script = ExtResource("1_mm7cb")
[node name="Particles" type="GPUParticles3D" parent="."]
unique_name_in_owner = true
cast_shadow = 0
amount = 2000
amount = 50
sub_emitter = NodePath("../Trail")
lifetime = 0.5
transform_align = 1
trail_lifetime = 0.5
process_material = SubResource("ParticleProcessMaterial_uyeuh")
draw_pass_1 = SubResource("QuadMesh_6nr8a")
[node name="Trail" type="GPUParticles3D" parent="."]
unique_name_in_owner = true
amount = 2500
lifetime = 0.5
transform_align = 1
process_material = SubResource("ParticleProcessMaterial_l1npq")
draw_pass_1 = SubResource("QuadMesh_pthhm")
[node name="Attractor" type="GPUParticlesAttractorSphere3D" parent="."]
unique_name_in_owner = true
strength = 2.0
radius = 0.5
[node name="Light" type="OmniLight3D" parent="."]
unique_name_in_owner = true
omni_range = 0.5
[node name="Sprite" type="Sprite3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0)
material_override = SubResource("StandardMaterial3D_ociyh")
billboard = 1
double_sided = false
texture = ExtResource("1_hhudy")
[node name="Area" type="Area3D" parent="."]
unique_name_in_owner = true
monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area"]
shape = SubResource("SphereShape3D_rytrf")
[connection signal="body_entered" from="Area" to="." method="on_body_entered"]

View File

@ -0,0 +1,7 @@
[gd_resource type="GradientTexture1D" load_steps=2 format=3 uid="uid://cfkwtmj6tc3wa"]
[sub_resource type="Gradient" id="Gradient_j8niy"]
colors = PackedColorArray(0.05, 0.5, 3, 1, 0, 0, 0, 1)
[resource]
gradient = SubResource("Gradient_j8niy")