diff options
Diffstat (limited to 'client/player/character')
| -rw-r--r-- | client/player/character/character.gd | 20 | ||||
| -rw-r--r-- | client/player/character/character.tscn | 41 | 
2 files changed, 54 insertions, 7 deletions
diff --git a/client/player/character/character.gd b/client/player/character/character.gd index 820cba74..36ff1323 100644 --- a/client/player/character/character.gd +++ b/client/player/character/character.gd @@ -1,18 +1,18 @@  # Undercooked - a game about cooking  # Copyright 2024 tpart -#  +#  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU Affero General Public License as published by  # the Free Software Foundation, version 3 of the License only. -#  +#  # This program is distributed in the hope that it will be useful,  # but WITHOUT ANY WARRANTY; without even the implied warranty of  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  # GNU Affero General Public License for more details. -#  +#  # You should have received a copy of the GNU Affero General Public License  # along with this program.  If not, see <https://www.gnu.org/licenses/>. -#  +#  extends Node3D  class_name Character @@ -21,6 +21,8 @@ const WALK_ANIM_SPEED:= 15.0  var walking := false  var holding := false +var boosting := false +var was_boosting := boosting  var current_animation := "idle" @@ -28,6 +30,8 @@ var current_animation := "idle"  @onready var main = $Main  @onready var default_height = main.position.y  @onready var main_height_target = default_height +@onready var walking_particles = $Walking +@onready var boosting_particles = $Boosting  @onready var hairstyles = {  	"Brown": $Main/Head/Hair, @@ -46,7 +50,7 @@ func _process(delta):  	else:  		t = 0  	main.position.y = main_height_target -	 +  	# Update animation:  	var next_animation: String  	if holding: @@ -55,7 +59,11 @@ func _process(delta):  		next_animation = "walk"  	else:  		next_animation = "idle" -	 + +	walking_particles.emitting = walking +	boosting_particles.emitting = boosting and walking and not was_boosting +	was_boosting = boosting and walking +  	if current_animation != next_animation:  		play_animation(next_animation) diff --git a/client/player/character/character.tscn b/client/player/character/character.tscn index 033135cd..cb5aa988 100644 --- a/client/player/character/character.tscn +++ b/client/player/character/character.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://b3hhir2fvnunu"] +[gd_scene load_steps=18 format=3 uid="uid://b3hhir2fvnunu"]  [ext_resource type="Script" path="res://player/character/character.gd" id="1_12lbh"]  [ext_resource type="ArrayMesh" uid="uid://bnmm01yjwultj" path="res://player/character/main.res" id="2_lxdbd"] @@ -565,6 +565,16 @@ _data = {  "walk": SubResource("Animation_7kiho")  } +[sub_resource type="SphereMesh" id="SphereMesh_xr0ql"] +radius = 0.1 +height = 0.2 + +[sub_resource type="SphereMesh" id="SphereMesh_qqngc"] + +[sub_resource type="Curve" id="Curve_7ml8g"] +_data = [Vector2(0, 0.054945), 0.0, 0.0, 0, 0, Vector2(0.174157, 1), 0.0, 0.0, 0, 0, Vector2(0.573034, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 4 +  [node name="guy" type="Node3D"]  script = ExtResource("1_12lbh") @@ -615,4 +625,33 @@ libraries = {  "": SubResource("AnimationLibrary_xtrfe")  } +[node name="Walking" type="CPUParticles3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2) +amount = 2 +lifetime = 0.5 +lifetime_randomness = 0.5 +mesh = SubResource("SphereMesh_xr0ql") +direction = Vector3(0, 0.5, -1) +initial_velocity_min = 1.0 +initial_velocity_max = 3.0 +scale_amount_min = 0.4 +scale_amount_max = 0.75 + +[node name="Boosting" type="CPUParticles3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2) +emitting = false +amount = 30 +lifetime = 0.3 +one_shot = true +explosiveness = 0.75 +lifetime_randomness = 0.5 +mesh = SubResource("SphereMesh_qqngc") +direction = Vector3(0, 0.5, -1) +gravity = Vector3(0, -0.1, 0) +initial_velocity_min = 1.0 +initial_velocity_max = 5.0 +scale_amount_min = 0.5 +scale_amount_max = 0.75 +scale_amount_curve = SubResource("Curve_7ml8g") +  [connection signal="animation_finished" from="HandAnimations" to="." method="_on_hand_animations_animation_finished"]  |