je sais pas trop
This commit is contained in:
@@ -43,7 +43,7 @@ right={
|
||||
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
interact={
|
||||
doigt={
|
||||
"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)
|
||||
]
|
||||
@@ -53,3 +53,8 @@ enter={
|
||||
"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":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
interact={
|
||||
"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)
|
||||
]
|
||||
}
|
||||
|
||||
30
scene/benitier.tscn
Normal file
30
scene/benitier.tscn
Normal file
@@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dvqwj3acw48bh"]
|
||||
|
||||
[ext_resource type="Script" path="res://script/benitier.gd" id="1_8g62g"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_wirhd"]
|
||||
radius = 1.67793
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_mv62m"]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_r12r5"]
|
||||
points = PackedVector3Array(-0.214183, -0.948028, -0.451129, 0.0227317, 0.952146, 0.498887, 0.171488, 0.951995, 0.469018, -0.125934, 0.952684, -0.483291, 0.499663, -0.953674, -0.00688883, -0.387646, -0.93796, 0.315653, -0.483292, 0.952686, -0.12593, 0.375097, 0.940128, -0.329816, 0.171488, -0.951995, 0.469018, 0.140783, -0.945485, -0.479579, 0.469014, 0.952011, 0.171499, -0.387646, 0.93796, 0.315653, -0.483292, -0.952686, -0.12593, -0.183511, -0.943076, 0.464698, 0.407412, -0.946994, 0.288983, 0.375097, -0.940128, -0.329816, -0.395154, 0.955761, -0.305523, -0.479555, 0.945437, 0.14088, 0.464698, 0.943099, -0.183512, 0.140783, 0.945485, -0.479579, -0.243203, 0.945955, 0.436491, -0.479555, -0.945437, 0.14088, 0.288971, 0.946988, 0.407421, -0.395154, -0.955761, -0.305523, -0.0069906, -0.953641, 0.499658, 0.499663, 0.953674, -0.00688883, -0.271948, 0.943071, -0.419217, 0.464698, -0.943099, -0.183512, -0.125934, -0.952684, -0.483291, 0.315648, 0.937973, -0.387651, 0.469014, -0.952011, 0.171499, 0.407412, 0.946994, 0.288983)
|
||||
|
||||
[node name="Benitier" type="Node3D"]
|
||||
script = ExtResource("1_8g62g")
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="."]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||
shape = SubResource("CylinderShape3D_wirhd")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("CylinderMesh_mv62m")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"]
|
||||
shape = SubResource("ConvexPolygonShape3D_r12r5")
|
||||
|
||||
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]
|
||||
[connection signal="body_exited" from="Area3D" to="." method="_on_area_3d_body_exited"]
|
||||
@@ -1,15 +1,24 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://b5rkwb64wgdwf"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://b5rkwb64wgdwf"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_248es"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_w6uy2"]
|
||||
curve = SubResource("Curve_248es")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_wf2yo"]
|
||||
lifetime_randomness = 0.1
|
||||
emission_shape_scale = Vector3(0.05, 0.05, 0.05)
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 1.0
|
||||
gravity = Vector3(0, -20, 0)
|
||||
damping_max = 30.0
|
||||
gravity = Vector3(0, 10, 0)
|
||||
scale_min = 0.1
|
||||
scale_max = 2.0
|
||||
scale_curve = SubResource("CurveTexture_w6uy2")
|
||||
turbulence_enabled = true
|
||||
turbulence_noise_strength = 0.1
|
||||
turbulence_noise_scale = 0.1
|
||||
sub_emitter_keep_velocity = true
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pq4g5"]
|
||||
albedo_color = Color(0, 1, 1, 1)
|
||||
@@ -21,7 +30,7 @@ height = 0.02
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D"]
|
||||
emitting = false
|
||||
amount = 150
|
||||
amount = 1000
|
||||
one_shot = true
|
||||
fixed_fps = 60
|
||||
process_material = SubResource("ParticleProcessMaterial_wf2yo")
|
||||
|
||||
@@ -41,7 +41,7 @@ tracks/1/keys = {
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("GPUParticles3D:emitting")
|
||||
tracks/2/path = NodePath("MainHugues/GPUParticles3D:emitting")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
@@ -73,7 +73,7 @@ tracks/0/path = NodePath("MainHugues:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.166667, 0.433333, 0.933333, 3.53333, 4.03333),
|
||||
"times": PackedFloat32Array(0.166667, 0.433333, 0.933333, 3, 4.03333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.00877896, -1.57553, 1.5708), Vector3(0.00877896, -1.57553, 1.5708), Vector3(0.00872665, -4.87645, 1.5708), Vector3(0.00872665, -4.87645, 1.5708), Vector3(0.00872665, 1.40674, 1.5708)]
|
||||
@@ -82,10 +82,10 @@ tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("MainHugues:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.166667, 0.433333, 0.933333, 3.53333, 4.03333),
|
||||
"times": PackedFloat32Array(0.166667, 0.433333, 0.933333, 3, 4.03333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.000633344, 0.311501, -0.254602), Vector3(0.000633359, 0.156883, -0.254602), Vector3(0.173339, 0.317806, -0.445379), Vector3(0.173339, 0.317806, -0.445379), Vector3(0.173339, -0.040048, -0.224093)]
|
||||
@@ -93,7 +93,7 @@ tracks/1/keys = {
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("GPUParticles3D:emitting")
|
||||
tracks/2/path = NodePath("MainHugues/GPUParticles3D:emitting")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
@@ -109,7 +109,7 @@ tracks/3/path = NodePath("MainHugues:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0.133333, 4.5),
|
||||
"times": PackedFloat32Array(0.0333333, 4.46667),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
@@ -124,11 +124,12 @@ _data = {
|
||||
[node name="CharacterBody3D" type="CharacterBody3D" node_paths=PackedStringArray("head", "anim", "particules")]
|
||||
script = ExtResource("1_kjuyr")
|
||||
SENSI = 0.002
|
||||
SPEED_PARTICULES = 50.0
|
||||
cooldown = 4.0
|
||||
SPEED_PARTICULES = 25.0
|
||||
cooldown = 4.5
|
||||
MIN_PARTICULES = 10
|
||||
head = NodePath("head")
|
||||
anim = NodePath("AnimationPlayer")
|
||||
particules = NodePath("GPUParticles3D")
|
||||
particules = NodePath("MainHugues/GPUParticles3D")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(0.999917, 0, 0.0128802, 0, 1, 0, -0.0128802, 0, 0.999917, 0, 0, 0)
|
||||
@@ -146,14 +147,14 @@ transform = Transform3D(1, 7.81702e-05, -0.000170007, -7.81212e-05, 1, 0.0002946
|
||||
material_override = SubResource("StandardMaterial3D_ohrfw")
|
||||
mesh = SubResource("CapsuleMesh_ha068")
|
||||
|
||||
[node name="GPUParticles3D" parent="." instance=ExtResource("2_ctykj")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.149993, 0.627285, -0.43281)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_jrykd")
|
||||
}
|
||||
|
||||
[node name="MainHugues" parent="." instance=ExtResource("3_wfafm")]
|
||||
transform = Transform3D(-2.18557e-09, 0.05, 0, -0.0499999, -2.18557e-09, 0, 0, 0, 0.05, 0.252187, 0, 0)
|
||||
transform = Transform3D(-1.80999e-07, 0.05, 0, -0.0499999, -1.81e-07, 0, 0, 0, 0.05, 0.252187, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="GPUParticles3D" parent="MainHugues" instance=ExtResource("2_ctykj")]
|
||||
transform = Transform3D(0.115272, 19.9992, -0.131047, 15.0171, -8.748e-07, 13.2093, 13.2088, -0.174531, -15.0165, 6.19877, 0.0196037, -0.570189)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://brc445tt624lb"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://brc445tt624lb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c74354tlmcg6h" path="res://scene/player.tscn" id="1_ka8xa"]
|
||||
[ext_resource type="Texture2D" uid="uid://dqae1tksey0vm" path="res://model/Floor_GrassTexture.png" id="1_odesb"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvqwj3acw48bh" path="res://scene/benitier.tscn" id="4_6ptmh"]
|
||||
[ext_resource type="PackedScene" uid="uid://du08nv2jrl6vr" path="res://scene/check_point.tscn" id="4_yoxfn"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b2syh"]
|
||||
@@ -41,7 +42,7 @@ mesh = SubResource("PlaneMesh_2hvdi")
|
||||
shape = SubResource("ConvexPolygonShape3D_0l50f")
|
||||
|
||||
[node name="CharacterBody3D" parent="." node_paths=PackedStringArray("checkpoint") instance=ExtResource("1_ka8xa")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.37761, 2.14163, 2.9378)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.11198, 1.44853, -0.634949)
|
||||
checkpoint = NodePath("../check_point")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
@@ -57,3 +58,6 @@ next_check = NodePath("../check_point2")
|
||||
|
||||
[node name="check_point2" parent="." instance=ExtResource("4_yoxfn")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -42.8789, 0.91909, 12.6078)
|
||||
|
||||
[node name="Benitier" parent="." instance=ExtResource("4_6ptmh")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.135166, 0.796541, 3.07849)
|
||||
|
||||
25
script/benitier.gd
Normal file
25
script/benitier.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends Node3D
|
||||
|
||||
var in_player:bool = false
|
||||
var player: CharacterBody3D = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if (in_player and Input.is_action_just_pressed("interact")):
|
||||
player.call("drink")
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body: Node3D) -> void:
|
||||
if (body is CharacterBody3D):
|
||||
in_player = true
|
||||
player = body
|
||||
|
||||
|
||||
func _on_area_3d_body_exited(body: Node3D) -> void:
|
||||
if (body is CharacterBody3D):
|
||||
in_player = false
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user