Make death look a bit nicer
This commit is contained in:
parent
b2dbd2deee
commit
41c50a764e
@ -8,13 +8,14 @@ glow_enabled = true
|
|||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
|
||||||
|
|
||||||
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "soldier_mesh", "collider", "splorch")]
|
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "soldier_mesh", "collider", "splorch", "dead_cam_target")]
|
||||||
look_sensitivity = 1.5
|
look_sensitivity = 1.5
|
||||||
camera = NodePath("camera_3d")
|
camera = NodePath("camera_3d")
|
||||||
move_speed = 5.0
|
move_speed = 5.0
|
||||||
soldier_mesh = NodePath("soldier_m")
|
soldier_mesh = NodePath("soldier_m")
|
||||||
collider = NodePath("collision_shape_3d2")
|
collider = NodePath("collision_shape_3d2")
|
||||||
splorch = NodePath("splorch")
|
splorch = NodePath("splorch")
|
||||||
|
dead_cam_target = NodePath("dead_camera_target")
|
||||||
health = 100
|
health = 100
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
|
|
||||||
@ -33,3 +34,6 @@ shape = SubResource("CapsuleShape3D_oh8vq")
|
|||||||
|
|
||||||
[node name="splorch" parent="." unique_id=986677517 instance=ExtResource("2_ywmwa")]
|
[node name="splorch" parent="." unique_id=986677517 instance=ExtResource("2_ywmwa")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.16157162, 1.4223524, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.16157162, 1.4223524, 0)
|
||||||
|
|
||||||
|
[node name="dead_camera_target" type="Node3D" parent="." unique_id=559969559]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.9069022, 0.4213412, 0, -0.4213412, 0.9069022, 0, 2.3258846, 1.5254744)
|
||||||
|
|||||||
@ -94,6 +94,8 @@ pub struct LocalPlayer {
|
|||||||
#[export]
|
#[export]
|
||||||
splorch: Option<Gd<GpuParticles3D>>,
|
splorch: Option<Gd<GpuParticles3D>>,
|
||||||
#[export]
|
#[export]
|
||||||
|
dead_cam_target: Option<Gd<Node3D>>,
|
||||||
|
#[export]
|
||||||
health: i32,
|
health: i32,
|
||||||
|
|
||||||
pub player_id: Option<u16>,
|
pub player_id: Option<u16>,
|
||||||
@ -264,6 +266,15 @@ impl ICharacterBody3D for LocalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.player_update(delta);
|
self.player_update(delta);
|
||||||
|
|
||||||
|
if self.is_dead
|
||||||
|
&& let Some(target) = &self.dead_cam_target
|
||||||
|
&& let Some(camera) = &mut self.camera
|
||||||
|
{
|
||||||
|
let camera_prev_pos = camera.get_global_position();
|
||||||
|
let new_pos = camera_prev_pos.lerp(target.get_global_position(), 0.1);
|
||||||
|
camera.set_global_position(new_pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn input(&mut self, event: Gd<InputEvent>) {
|
fn input(&mut self, event: Gd<InputEvent>) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user