game: add shooting
This commit is contained in:
185
game/player.tscn
185
game/player.tscn
@@ -1,7 +1,10 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dkldpdufpl28x"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://dkldpdufpl28x"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5vty5riyfef2" path="res://Player.gd" id="1_4flbx"]
|
||||
[ext_resource type="Script" uid="uid://cad5seggccvp6" path="res://player_debug.gd" id="2_onrkg"]
|
||||
[ext_resource type="PackedScene" uid="uid://ditco83gy03gm" path="res://models/pistol.glb" id="3_hqtel"]
|
||||
[ext_resource type="Script" uid="uid://7ads6wescib" path="res://player_stats.gd" id="3_i3pqv"]
|
||||
[ext_resource type="Texture2D" uid="uid://cmldtn5n8a7vr" path="res://assets/textures/star_01.png" id="4_sweqy"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_fj7yv"]
|
||||
|
||||
@@ -10,8 +13,159 @@ points = PackedVector3Array(-0.125207, -0.532801, -0.480507, 0.0227831, 0.47607,
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_4flbx"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_2hs0m"]
|
||||
offsets = PackedFloat32Array(0, 0.0695876, 1)
|
||||
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_1jxqw"]
|
||||
gradient = SubResource("Gradient_2hs0m")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_dw050"]
|
||||
angle_min = 45.0
|
||||
angle_max = 45.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
color_ramp = SubResource("GradientTexture1D_1jxqw")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_b26j0"]
|
||||
transparency = 1
|
||||
shading_mode = 0
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_color = Color(1, 0.87451, 0.635294, 1)
|
||||
albedo_texture = ExtResource("4_sweqy")
|
||||
billboard_mode = 3
|
||||
particles_anim_h_frames = 1
|
||||
particles_anim_v_frames = 1
|
||||
particles_anim_loop = false
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_n7ghd"]
|
||||
material = SubResource("StandardMaterial3D_b26j0")
|
||||
size = Vector2(0.4, 0.4)
|
||||
orientation = 2
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hqtel"]
|
||||
resource_name = "idle"
|
||||
length = 3.0
|
||||
loop_mode = 1
|
||||
step = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Head/PlayerCamera/pistol: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.492394, -0.353437, -0.607601), Vector3(0.492394, -0.374851, -0.607601)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Head/PlayerCamera/pistol: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, 0.0417832, 0), Vector3(-0.133121, 0.0421564, -0.00559862)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_sweqy"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Head/PlayerCamera/pistol:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.492394, -0.353437, -0.607601)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0.0417832, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2hs0m"]
|
||||
resource_name = "move"
|
||||
loop_mode = 1
|
||||
step = 0.25
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Head/PlayerCamera/pistol:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.492394, -0.353437, -0.607601), Vector3(0.455433, -0.331914, -0.607601), Vector3(0.492394, -0.353437, -0.607601), Vector3(0.523617, -0.353437, -0.607601)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0.0417832, 0), Vector3(0.0412236, 0.0418187, 0.00172443), Vector3(0, 0.0417832, 0), Vector3(-0.0368292, 0.0418116, -0.00154043)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1jxqw"]
|
||||
resource_name = "shoot"
|
||||
length = 0.4
|
||||
step = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Head/PlayerCamera/pistol:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(0.5, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.492394, -0.353437, -0.607601), Vector3(0.492394, -0.353437, -0.607601)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(0.5, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.404943, 0.0454622, 0.017921), Vector3(0, 0.0417832, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1jxqw"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_sweqy"),
|
||||
&"idle": SubResource("Animation_hqtel"),
|
||||
&"move": SubResource("Animation_2hs0m"),
|
||||
&"shoot": SubResource("Animation_1jxqw")
|
||||
}
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
visible = false
|
||||
script = ExtResource("1_4flbx")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
@@ -33,12 +187,35 @@ skeleton = NodePath("../..")
|
||||
[node name="PlayerCamera" type="Camera3D" parent="Head"]
|
||||
|
||||
[node name="PlayerDebug" type="CanvasLayer" parent="Head/PlayerCamera"]
|
||||
visible = false
|
||||
script = ExtResource("2_onrkg")
|
||||
|
||||
[node name="PlayerDebugText" type="RichTextLabel" parent="Head/PlayerCamera/PlayerDebug"]
|
||||
offset_right = 635.0
|
||||
offset_bottom = 283.0
|
||||
text = "example_stat: 10.0"
|
||||
|
||||
[node name="DashTimer" type="Timer" parent="."]
|
||||
[node name="pistol" parent="Head/PlayerCamera" instance=ExtResource("3_hqtel")]
|
||||
transform = Transform3D(0.999127, 0, 0.041771, 0, 1, 0, -0.041771, 0, 0.999127, 0.492394, -0.353437, -0.607601)
|
||||
|
||||
[node name="MuzzleFlash" type="GPUParticles3D" parent="Head/PlayerCamera/pistol"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.57628e-06, 0.0631319, -0.278016)
|
||||
emitting = false
|
||||
lifetime = 0.15
|
||||
one_shot = true
|
||||
local_coords = true
|
||||
process_material = SubResource("ParticleProcessMaterial_dw050")
|
||||
draw_pass_1 = SubResource("PlaneMesh_n7ghd")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="Head/PlayerCamera/pistol"]
|
||||
transform = Transform3D(0.998255, -0.041771, 0.0417346, 0.041771, -4.37114e-08, -0.999127, 0.0417346, 0.999127, 0.00174477, 0.000758827, 0.0641694, -0.246936)
|
||||
target_position = Vector3(0, -50, 0)
|
||||
|
||||
[node name="PlayerStats" type="Node" parent="."]
|
||||
script = ExtResource("3_i3pqv")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_1jxqw")
|
||||
}
|
||||
autoplay = "move"
|
||||
playback_default_blend_time = 0.05
|
||||
|
Reference in New Issue
Block a user