mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
Merge branch 'feat/first-pass-animations' into 'develop'
✨ First-pass player animations: idle, shooting See merge request open-fpsz/open-fpsz!18
This commit is contained in:
commit
7714656d21
Binary file not shown.
|
|
@ -31,6 +31,7 @@ var gravity : Vector3 = g * ProjectSettings.get_setting("physics/3d/default_gra
|
|||
@onready var hud = $HUD
|
||||
@onready var shape_cast = $ShapeCast3D
|
||||
@onready var weapon = $SpringArm3D/Inventory/SpaceGun
|
||||
@onready var weapon_animations : AnimationPlayer = $WeaponAnimations
|
||||
|
||||
@onready var spring_arm_height = $SpringArm3D.position.y
|
||||
|
||||
|
|
@ -39,6 +40,8 @@ signal energy_changed(energy)
|
|||
|
||||
var _jumping = false
|
||||
|
||||
@onready var _original_weapon_transform : Transform3D = weapon.transform
|
||||
|
||||
func _ready():
|
||||
energy_changed.connect(hud._on_energy_changed)
|
||||
$HealthComponent.health_changed.connect(hud._on_health_changed)
|
||||
|
|
@ -53,7 +56,14 @@ func _ready():
|
|||
func _fire_primary():
|
||||
if player_state == PlayerState.PLAYER_DEAD:
|
||||
return
|
||||
$"SpringArm3D/Inventory/SpaceGun".fire_primary()
|
||||
if not weapon.can_fire():
|
||||
return
|
||||
var current_weapon_transform = weapon.transform
|
||||
weapon.transform = _original_weapon_transform
|
||||
weapon.fire_primary()
|
||||
weapon.transform = current_weapon_transform
|
||||
weapon_animations.stop()
|
||||
weapon_animations.play("shoot")
|
||||
|
||||
func _jump():
|
||||
if player_state == PlayerState.PLAYER_DEAD:
|
||||
|
|
@ -84,6 +94,11 @@ func _process(delta):
|
|||
return
|
||||
%SpringArm3D.global_transform.basis = Basis.from_euler(Vector3(input.camera_rotation.y, input.camera_rotation.x, 0.0))
|
||||
|
||||
if weapon_animations.current_animation == "shoot":
|
||||
pass
|
||||
else:
|
||||
weapon_animations.play("idle")
|
||||
|
||||
func _physics_process(delta):
|
||||
if player_state == PlayerState.PLAYER_DEAD:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://cbhx1xme0sb7k"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://cbhx1xme0sb7k"]
|
||||
|
||||
[ext_resource type="Script" path="res://characters/player/player.gd" id="1_ymjub"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcv81ku26xo" path="res://interfaces/hud/hud.tscn" id="2_5qvi2"]
|
||||
|
|
@ -16,7 +16,7 @@ absorbent = true
|
|||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_vmqfq"]
|
||||
material = SubResource("StandardMaterial3D_1hdqa")
|
||||
radius = 0.3
|
||||
radius = 0.25
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_rqdp6"]
|
||||
properties/0/path = NodePath(".:linear_velocity")
|
||||
|
|
@ -52,6 +52,96 @@ properties/3/path = NodePath(".:skiing")
|
|||
properties/3/spawn = false
|
||||
properties/3/replication_mode = 2
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cb46l"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("SpringArm3D/Inventory/SpaceGun:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.244668, -0.229311, -0.30332)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("SpringArm3D/Inventory/SpaceGun:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 3.14159, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_as2v0"]
|
||||
resource_name = "idle"
|
||||
length = 3.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("SpringArm3D/Inventory/SpaceGun:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.5),
|
||||
"transitions": PackedFloat32Array(-2, -2),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.244668, -0.229311, -0.30332), Vector3(0.244668, -0.26057, -0.30332)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("SpringArm3D/Inventory/SpaceGun:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1.5),
|
||||
"transitions": PackedFloat32Array(-2, -2),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 3.14159, 0), Vector3(0.114371, 3.14159, -1.73453e-08)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_p84l0"]
|
||||
resource_name = "shoot"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("SpringArm3D/Inventory/SpaceGun:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(0.5, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.244668, -0.204488, -0.268482), Vector3(0.244668, -0.229311, -0.30332)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("SpringArm3D/Inventory/SpaceGun:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(0.5, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(-0.0584511, 3.14159, 8.83593e-09), Vector3(0, 3.14159, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hg307"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_cb46l"),
|
||||
"idle": SubResource("Animation_as2v0"),
|
||||
"shoot": SubResource("Animation_p84l0")
|
||||
}
|
||||
|
||||
[node name="Player" type="RigidBody3D"]
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
|
|
@ -87,7 +177,7 @@ near = 0.1
|
|||
[node name="Inventory" type="Node3D" parent="SpringArm3D"]
|
||||
|
||||
[node name="SpaceGun" parent="SpringArm3D/Inventory" instance=ExtResource("2_ka38u")]
|
||||
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0.281712, -0.095, -0.353461)
|
||||
transform = Transform3D(-1, 0, 2.53518e-06, 0, 1, 0, -2.53518e-06, 0, -1, 0.244668, -0.229311, -0.30332)
|
||||
|
||||
[node name="HealthComponent" parent="." instance=ExtResource("5_dlsxj")]
|
||||
|
||||
|
|
@ -98,3 +188,10 @@ replication_config = SubResource("SceneReplicationConfig_rqdp6")
|
|||
root_path = NodePath(".")
|
||||
replication_config = SubResource("SceneReplicationConfig_5j4ew")
|
||||
script = ExtResource("6_xwlxv")
|
||||
|
||||
[node name="WeaponAnimations" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_hg307")
|
||||
}
|
||||
autoplay = "idle"
|
||||
playback_default_blend_time = 0.05
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ var weapon_state : WeaponState = WeaponState.WEAPON_READY
|
|||
const inheritance : float = .5 # ratio
|
||||
const reload_time : float = 1. # seconds
|
||||
|
||||
func can_fire():
|
||||
return weapon_state == WeaponState.WEAPON_READY
|
||||
|
||||
func fire_primary():
|
||||
if weapon_state != WeaponState.WEAPON_READY:
|
||||
if not can_fire():
|
||||
return
|
||||
|
||||
var projectile = PROJECTILE.instantiate()
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ shadow_mesh = SubResource("ArrayMesh_2hpnh")
|
|||
script = ExtResource("1_6sm4s")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0.1, -0.078, 0.2)
|
||||
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, 0.15, -0.1, 0.3)
|
||||
layers = 1048575
|
||||
mesh = SubResource("ArrayMesh_hudfn")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="Nozzle" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.315549)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.540839)
|
||||
|
|
|
|||
Loading…
Reference in a new issue