je sais pas trop

This commit is contained in:
2025-01-18 15:10:32 +01:00
parent 7b2222dfa7
commit f1bfb48fcf
7 changed files with 107 additions and 25 deletions

View File

@@ -6,14 +6,16 @@ extends CharacterBody3D
@export var SPEED_PARTICULES: float = 1;
@export var checkpoint:Node3D = null
@export var cooldown: float = 1
@export var MAX_PARTICULES = 1000
@export var MIN_PARTICULES = 50
@export_group("Children")
@export var head: Node3D
@export var anim: AnimationPlayer
@export var particules: GPUParticles3D
@export var time_hand: float= 0
var time_hand: float= 0
var nbr_particules = 1000
func _ready() -> void:
time_hand = cooldown
@@ -35,15 +37,18 @@ func _physics_process(delta: float) -> void:
else:
velocity += get_gravity() * delta * 3
if (Input.is_action_just_pressed("interact") and time_hand >= cooldown):
if (Input.is_action_just_pressed("doigt") and time_hand >= cooldown):
time_hand = 0
var vect
if(checkpoint == null):
vect = Vector3.DOWN * SPEED_PARTICULES
else:
vect = (checkpoint.position - position).normalized() * SPEED_PARTICULES
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")
var input_dir := Input.get_vector("left", "right", "up", "down")
@@ -56,3 +61,6 @@ func _physics_process(delta: float) -> void:
velocity.z = move_toward(velocity.z, 0, SPEED)
move_and_slide()
func drink() -> void:
nbr_particules = MAX_PARTICULES