trop de chose jpp

This commit is contained in:
2025-01-18 10:43:11 +01:00
parent 913a455d33
commit 309496c900
19 changed files with 546 additions and 21 deletions

11
script/check_point.gd Normal file
View File

@@ -0,0 +1,11 @@
extends Node3D
@export var next_check : Node3D = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _on_area_3d_body_entered(body: Node3D) -> void:
if (body is CharacterBody3D):
body.set("checkpoint", next_check)

12
script/menu.gd Normal file
View File

@@ -0,0 +1,12 @@
extends Node3D
@export var next_scene: PackedScene = null
var scene_manager: Node = null
func _ready() -> void:
scene_manager = get_tree().root.get_node("scene_manager")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
if(Input.is_action_just_pressed("enter")):
scene_manager.emit_signal("change_scene_signal", next_scene)

View File

@@ -3,19 +3,15 @@ extends CharacterBody3D
@export var SPEED: float = 10.0
@export var SENSI : float = 0.005
@export var SPEED_PARTICULES: float = 1;
@export var checkpoint:Node3D = null
@export_group("Children")
@export var head: Node3D
@export var anim: AnimationPlayer
@export var particules: GPUParticles3D
var life: float = 100
var delay_shot:float = 0
var bullets:int = 11
var reloading:bool = false
var current_time_reloading: float = 0
var bump: Vector3 = Vector3.ZERO
var current_song = 0
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
@@ -35,6 +31,15 @@ func _physics_process(delta: float) -> void:
velocity += get_gravity() * delta * 2
else:
velocity += get_gravity() * delta * 3
if (Input.is_action_just_pressed("interact")):
var vect
if(checkpoint == null):
vect = Vector3.DOWN * SPEED_PARTICULES
else:
vect = (checkpoint.position - position).normalized() * SPEED_PARTICULES
particules.process_material.set("gravity", vect)
anim.play("finger")
var input_dir := Input.get_vector("left", "right", "up", "down")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()