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

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