placeholder gun animation and player scripts
This commit is contained in:
parent
464c5ecfd5
commit
ed684b694b
6 changed files with 137 additions and 85 deletions
|
@ -1,76 +1,62 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=12 format=3 uid="uid://dxxoeig43tt5e"]
|
||||
[gd_resource type="AnimationLibrary" load_steps=8 format=3 uid="uid://cw8bt4hqxpk55"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cf7avgppv4kfk" path="res://base/assets/guns/placeholder/static.png" id="1_yheqn"]
|
||||
[ext_resource type="Texture2D" uid="uid://ij02cx0xdckw" path="res://base/assets/guns/placeholder/reload1.png" id="2_gi6cb"]
|
||||
[ext_resource type="Texture2D" uid="uid://baptu307a0dw5" path="res://base/assets/guns/placeholder/reload2.png" id="3_41o6a"]
|
||||
[ext_resource type="Texture2D" uid="uid://pb6jybpwasxj" path="res://base/assets/guns/placeholder/reload3.png" id="4_1qj27"]
|
||||
[ext_resource type="Texture2D" uid="uid://v2m8ikar64o5" path="res://base/assets/guns/placeholder/reload4.png" id="5_7xjr5"]
|
||||
[ext_resource type="Texture2D" uid="uid://b40b8l3yctlax" path="res://base/assets/guns/placeholder/reload5.png" id="6_vbrhv"]
|
||||
[ext_resource type="Texture2D" uid="uid://b55h6w4km2c3u" path="res://base/assets/guns/placeholder/reload6.png" id="7_deanl"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4fp0oo8qcino" path="res://base/assets/guns/placeholder/reload7.png" id="8_kiu0k"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfw6p5g680c55" path="res://base/assets/guns/placeholder/shoot1.png" id="9_6fi3a"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwfkjfpk4dwx0" path="res://base/assets/guns/placeholder/shoot2.png" id="10_mjqfp"]
|
||||
[ext_resource type="Texture2D" uid="uid://bp1frp3sm8bic" path="res://base/assets/guns/placeholder/shoot3.png" id="11_0d256"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ma1q3"]
|
||||
resource_name = "static"
|
||||
length = 0.001
|
||||
step = 0.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("1_yheqn")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_i1xqq"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [null]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8sdfx"]
|
||||
resource_name = "shoot"
|
||||
length = 0.30001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("1_yheqn"), ExtResource("9_6fi3a"), ExtResource("10_mjqfp"), ExtResource("11_0d256")]
|
||||
}
|
||||
|
||||
[resource]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("1_yheqn")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"default",
|
||||
"speed": 0.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_gi6cb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_41o6a")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_1qj27")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_1qj27")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_7xjr5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("6_vbrhv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("6_vbrhv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("6_vbrhv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("7_deanl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("7_deanl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("8_kiu0k")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"reload",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("9_6fi3a")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("10_mjqfp")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("11_0d256")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"shoot",
|
||||
"speed": 10.0
|
||||
}]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_i1xqq"),
|
||||
&"shoot": SubResource("Animation_8sdfx"),
|
||||
&"static": SubResource("Animation_ma1q3")
|
||||
}
|
||||
|
|
|
@ -1,9 +1,44 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dwx5tcatj35gu"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dwx5tcatj35gu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cf7avgppv4kfk" path="res://base/assets/guns/placeholder/static.png" id="1_7s1wv"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfw6p5g680c55" path="res://base/assets/guns/placeholder/shoot1.png" id="2_7ptt8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwfkjfpk4dwx0" path="res://base/assets/guns/placeholder/shoot2.png" id="3_1w3ab"]
|
||||
[ext_resource type="Texture2D" uid="uid://bp1frp3sm8bic" path="res://base/assets/guns/placeholder/shoot3.png" id="4_gt0rj"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jjqxs"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_i1xqq"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [null]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8sdfx"]
|
||||
resource_name = "shoot"
|
||||
length = 0.20001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("2_7ptt8"), ExtResource("3_1w3ab"), ExtResource("4_gt0rj")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ma1q3"]
|
||||
resource_name = "static"
|
||||
length = 0.001
|
||||
|
@ -21,24 +56,10 @@ tracks/0/keys = {
|
|||
"values": [ExtResource("1_7s1wv")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_i1xqq"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [null]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7ptt8"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_i1xqq"),
|
||||
&"shoot": SubResource("Animation_8sdfx"),
|
||||
&"static": SubResource("Animation_ma1q3")
|
||||
}
|
||||
|
||||
|
|
31
base/scripts/player/command_stack.gd
Normal file
31
base/scripts/player/command_stack.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
extends RefCounted
|
||||
|
||||
class_name CommandStack
|
||||
## Commands that can be pushed to stack
|
||||
enum Command {
|
||||
None,
|
||||
TakeWeapon,
|
||||
Shoot,
|
||||
Reload,
|
||||
HolsterWeapon,
|
||||
TakeZaza,
|
||||
LightZaza,
|
||||
Smoke
|
||||
}
|
||||
|
||||
var left_command_stack: Array[Command] = []
|
||||
var right_command_stack: Array[Command] = []
|
||||
|
||||
func push(left_command: Command = Command.None, right_command: Command = Command.None):
|
||||
left_command_stack.push_back(left_command)
|
||||
right_command_stack.push_back(right_command)
|
||||
|
||||
func pop():
|
||||
left_command_stack.pop_back()
|
||||
right_command_stack.pop_back()
|
||||
|
||||
func current_left_command() -> Command:
|
||||
return left_command_stack.back()
|
||||
|
||||
func current_right_command() -> Command:
|
||||
return right_command_stack.back()
|
1
base/scripts/player/command_stack.gd.uid
Normal file
1
base/scripts/player/command_stack.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://dackkxqximesc
|
12
base/scripts/player/player.gd
Normal file
12
base/scripts/player/player.gd
Normal file
|
@ -0,0 +1,12 @@
|
|||
extends RigidBody3D
|
||||
|
||||
var stack: CommandStack = CommandStack.new()
|
||||
|
||||
# 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:
|
||||
pass
|
1
base/scripts/player/player.gd.uid
Normal file
1
base/scripts/player/player.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://dts8lbivkgsmj
|
Loading…
Add table
Add a link
Reference in a new issue