This commit is contained in:
2025-01-18 15:45:09 +01:00
parent f1bfb48fcf
commit 114e09172f
6 changed files with 94 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ right={
} }
doigt={ doigt={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
] ]
} }
enter={ enter={

71
scene/display_song.tscn Normal file
View File

@@ -0,0 +1,71 @@
[gd_scene load_steps=6 format=3 uid="uid://bi1sl1tcpssyd"]
[ext_resource type="Script" path="res://script/display_song.gd" id="1_el3j1"]
[ext_resource type="Theme" uid="uid://dwtios6w33wxq" path="res://theme/label_theme.tres" id="2_p16cs"]
[sub_resource type="Animation" id="Animation_2j0q6"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Control:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_a1cki"]
resource_name = "alphapasla"
length = 6.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Control:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.966667, 5, 6),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_86fsc"]
_data = {
"RESET": SubResource("Animation_2j0q6"),
"alphapasla": SubResource("Animation_a1cki")
}
[node name="display_song" type="CanvasLayer" node_paths=PackedStringArray("label", "anim")]
script = ExtResource("1_el3j1")
label = NodePath("Control/Label")
anim = NodePath("AnimationPlayer")
[node name="Control" type="Control" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
grow_vertical = 0
[node name="Label" type="Label" parent="Control"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -23.0
offset_right = 80.0
grow_vertical = 0
theme = ExtResource("2_p16cs")
theme_override_font_sizes/font_size = 90
text = "qwrertuiioyo"
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_86fsc")
}

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=10 format=3 uid="uid://c74354tlmcg6h"] [gd_scene load_steps=11 format=3 uid="uid://c74354tlmcg6h"]
[ext_resource type="Script" path="res://script/player.gd" id="1_kjuyr"] [ext_resource type="Script" path="res://script/player.gd" id="1_kjuyr"]
[ext_resource type="PackedScene" uid="uid://bi1sl1tcpssyd" path="res://scene/display_song.tscn" id="2_0o8k8"]
[ext_resource type="PackedScene" uid="uid://b5rkwb64wgdwf" path="res://scene/gpu_particles_3d.tscn" id="2_ctykj"] [ext_resource type="PackedScene" uid="uid://b5rkwb64wgdwf" path="res://scene/gpu_particles_3d.tscn" id="2_ctykj"]
[ext_resource type="PackedScene" uid="uid://cqla6v58rvrqd" path="res://scene/main.tscn" id="3_wfafm"] [ext_resource type="PackedScene" uid="uid://cqla6v58rvrqd" path="res://scene/main.tscn" id="3_wfafm"]
@@ -121,7 +122,7 @@ _data = {
"finger": SubResource("Animation_njhrs") "finger": SubResource("Animation_njhrs")
} }
[node name="CharacterBody3D" type="CharacterBody3D" node_paths=PackedStringArray("head", "anim", "particules")] [node name="CharacterBody3D" type="CharacterBody3D" node_paths=PackedStringArray("head", "anim", "particules", "canvas")]
script = ExtResource("1_kjuyr") script = ExtResource("1_kjuyr")
SENSI = 0.002 SENSI = 0.002
SPEED_PARTICULES = 25.0 SPEED_PARTICULES = 25.0
@@ -130,6 +131,9 @@ MIN_PARTICULES = 10
head = NodePath("head") head = NodePath("head")
anim = NodePath("AnimationPlayer") anim = NodePath("AnimationPlayer")
particules = NodePath("MainHugues/GPUParticles3D") particules = NodePath("MainHugues/GPUParticles3D")
canvas = NodePath("display_song")
[node name="display_song" parent="." instance=ExtResource("2_0o8k8")]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(0.999917, 0, 0.0128802, 0, 1, 0, -0.0128802, 0, 0.999917, 0, 0, 0) transform = Transform3D(0.999917, 0, 0.0128802, 0, 1, 0, -0.0128802, 0, 0.999917, 0, 0, 0)

View File

@@ -9,7 +9,7 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(_delta: float)-> void:
if (in_player and Input.is_action_just_pressed("interact")): if (in_player and Input.is_action_just_pressed("interact")):
player.call("drink") player.call("drink")
@@ -18,6 +18,7 @@ func _on_area_3d_body_entered(body: Node3D) -> void:
if (body is CharacterBody3D): if (body is CharacterBody3D):
in_player = true in_player = true
player = body player = body
player.call("display_drink")
func _on_area_3d_body_exited(body: Node3D) -> void: func _on_area_3d_body_exited(body: Node3D) -> void:

9
script/display_song.gd Normal file
View File

@@ -0,0 +1,9 @@
extends CanvasLayer
@export var label:Label = null
@export var anim: AnimationPlayer = null
func display_song_name(text: String) -> void:
anim.play("RESET")
label.text = text
anim.play("alphapasla")

View File

@@ -13,6 +13,7 @@ extends CharacterBody3D
@export var head: Node3D @export var head: Node3D
@export var anim: AnimationPlayer @export var anim: AnimationPlayer
@export var particules: GPUParticles3D @export var particules: GPUParticles3D
@export var canvas: CanvasLayer
var time_hand: float= 0 var time_hand: float= 0
var nbr_particules = 1000 var nbr_particules = 1000
@@ -21,12 +22,11 @@ func _ready() -> void:
time_hand = cooldown time_hand = cooldown
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
add_to_group("player") add_to_group("player")
canvas.call("display_song_name", "Clic gauche pour se repérer.")
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
#head.rotate_x(-event.relative.y * SENSI)
rotate_y(-event.relative.x * SENSI) rotate_y(-event.relative.x * SENSI)
#head.rotation.x = clamp(head.rotation.x, -PI/2, PI/2)
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
time_hand += delta time_hand += delta
@@ -47,7 +47,7 @@ func _physics_process(delta: float) -> void:
particules.amount = nbr_particules particules.amount = nbr_particules
nbr_particules /= 2 nbr_particules /= 2
nbr_particules = clamp(nbr_particules, MIN_PARTICULES, MAX_PARTICULES) nbr_particules = clamp(nbr_particules, MIN_PARTICULES, MAX_PARTICULES)
print(nbr_particules)
particules.process_material.set("gravity", vect) particules.process_material.set("gravity", vect)
anim.play("finger") anim.play("finger")
@@ -64,3 +64,5 @@ func _physics_process(delta: float) -> void:
func drink() -> void: func drink() -> void:
nbr_particules = MAX_PARTICULES nbr_particules = MAX_PARTICULES
func display_drink()->void:
canvas.call("display_song_name", "E pour boire.")