main scene anim player
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://b4ot3p50x08po"]
|
[gd_scene load_steps=12 format=3 uid="uid://b4ot3p50x08po"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cuqeg7u667dw6" path="res://Blends/Room/room.gltf" id="1_jjgbg"]
|
[ext_resource type="PackedScene" uid="uid://cuqeg7u667dw6" path="res://Blends/Room/room.gltf" id="1_jjgbg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://j06vthscroca" path="res://Scenes/bullet.tscn" id="3_8gbba"]
|
[ext_resource type="PackedScene" uid="uid://j06vthscroca" path="res://Scenes/bullet.tscn" id="3_8gbba"]
|
||||||
@@ -6,6 +6,95 @@
|
|||||||
[ext_resource type="Script" uid="uid://dcmqt4341kxem" path="res://Scripts/bullet_stack.gd" id="4_kry3j"]
|
[ext_resource type="Script" uid="uid://dcmqt4341kxem" path="res://Scripts/bullet_stack.gd" id="4_kry3j"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bueqdw22nl501" path="res://Scenes/AI.tscn" id="5_kry3j"]
|
[ext_resource type="PackedScene" uid="uid://bueqdw22nl501" path="res://Scenes/AI.tscn" id="5_kry3j"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cbr3e8xsfwyhf" path="res://Scenes/main_game_ui.tscn" id="6_21xkr"]
|
[ext_resource type="PackedScene" uid="uid://cbr3e8xsfwyhf" path="res://Scenes/main_game_ui.tscn" id="6_21xkr"]
|
||||||
|
[ext_resource type="Script" uid="uid://cwj0jaw6impcj" path="res://Scripts/main_animation_player.gd" id="7_6bp64"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_21xkr"]
|
||||||
|
resource_name = "player_revolver_up"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("revolver:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1.02871, 3.34454, 0.425178), Vector3(1.02871, 4.11691, 0.425178)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("revolver:rotation")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 1.5708), Vector3(0, 0, 3.14159)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_6bp64"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("revolver:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1.02871, 3.34454, 0.425178)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("revolver: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, 1.5708)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_344ge"]
|
||||||
|
resource_name = "player_revolver_down"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("revolver:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(1.02871, 4.11691, 0.425178), Vector3(1.02871, 3.34454, 0.425178)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("revolver:rotation")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector3(0, 0, 3.14159), Vector3(0, 0, 1.5708)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_344ge"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_6bp64"),
|
||||||
|
&"player_revolver_down": SubResource("Animation_344ge"),
|
||||||
|
&"player_revolver_up": SubResource("Animation_21xkr")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Node3D" type="Node3D"]
|
[node name="Node3D" type="Node3D"]
|
||||||
|
|
||||||
@@ -82,3 +171,11 @@ target_angle_up = Vector3(0, -180, 180)
|
|||||||
target_angle_down = Vector3(0, 180, -90)
|
target_angle_down = Vector3(0, 180, -90)
|
||||||
|
|
||||||
[node name="MainGame" parent="." instance=ExtResource("6_21xkr")]
|
[node name="MainGame" parent="." instance=ExtResource("6_21xkr")]
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_344ge")
|
||||||
|
}
|
||||||
|
script = ExtResource("7_6bp64")
|
||||||
|
|
||||||
|
[connection signal="animation_finished" from="AnimationPlayer" to="AnimationPlayer" method="_on_animation_finished"]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_ncs2m"]
|
[sub_resource type="Animation" id="Animation_ncs2m"]
|
||||||
resource_name = "cylinder_out"
|
resource_name = "cylinder_out"
|
||||||
|
length = 0.5
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
@@ -12,8 +13,8 @@ tracks/0/path = NodePath("Cylinder_002:position")
|
|||||||
tracks/0/interp = 2
|
tracks/0/interp = 2
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 1),
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1, 1.7411),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector3(0.0429976, 0.542699, 3.97893), Vector3(2.0611, 0.542699, 3.97893)]
|
"values": [Vector3(0.0429976, 0.542699, 3.97893), Vector3(2.0611, 0.542699, 3.97893)]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,14 @@ var is_player1_loaded: bool = false
|
|||||||
var is_player2_loaded: bool = false
|
var is_player2_loaded: bool = false
|
||||||
var bullet_stack: Node3D
|
var bullet_stack: Node3D
|
||||||
|
|
||||||
|
var animPl: AnimationPlayer
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
bullet_shoot.connect(on_bullet_shoot)
|
bullet_shoot.connect(on_bullet_shoot)
|
||||||
bullet_selected.connect(on_bullet_selected)
|
bullet_selected.connect(on_bullet_selected)
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_released("load"):
|
if event.is_action_released("load"):
|
||||||
set_state(GameState.PLAYER1_GUN_LOAD)
|
set_player_turn()
|
||||||
elif event.is_action_released("load2"):
|
elif event.is_action_released("load2"):
|
||||||
player1_revolver.load_bullet(bullet_stack.bullets[1])
|
player1_revolver.load_bullet(bullet_stack.bullets[1])
|
||||||
|
|
||||||
@@ -66,13 +68,13 @@ func check_loaded_bullets(revolver: Node3D):
|
|||||||
func end_player_turn():
|
func end_player_turn():
|
||||||
if !is_player2_loaded:
|
if !is_player2_loaded:
|
||||||
set_state(GameState.PLAYER2_GUN_LOAD)
|
set_state(GameState.PLAYER2_GUN_LOAD)
|
||||||
|
animPl.play("player_revolver_down")
|
||||||
end_turn()
|
end_turn()
|
||||||
|
|
||||||
func end_enemy_turn():
|
func end_enemy_turn():
|
||||||
if is_player1_loaded == false:
|
if is_player1_loaded == false:
|
||||||
print("Player Turn")
|
print("Player Turn")
|
||||||
set_state(GameState.PLAYER1_GUN_LOAD)
|
set_player_turn()
|
||||||
end_turn()
|
end_turn()
|
||||||
func end_turn():
|
func end_turn():
|
||||||
if check_unloaded_bullets():
|
if check_unloaded_bullets():
|
||||||
@@ -95,3 +97,12 @@ func get_phase2_player_start():
|
|||||||
|
|
||||||
func on_bullet_shoot(target):
|
func on_bullet_shoot(target):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func set_player_turn():
|
||||||
|
animPl.play("player_revolver_up")
|
||||||
|
func on_animation_finished(anim_name):
|
||||||
|
if anim_name == "player_revolver_up":
|
||||||
|
set_state(GameState.PLAYER1_GUN_LOAD)
|
||||||
|
elif anim_name == "player_revolver_down":
|
||||||
|
set_state(GameState.PLAYER2_GUN_LOAD)
|
||||||
|
|||||||
8
Scripts/main_animation_player.gd
Normal file
8
Scripts/main_animation_player.gd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
extends AnimationPlayer
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
GameManager.animPl = self
|
||||||
|
|
||||||
|
func _on_animation_finished(anim_name: StringName) -> void:
|
||||||
|
GameManager.on_animation_finished(anim_name)
|
||||||
1
Scripts/main_animation_player.gd.uid
Normal file
1
Scripts/main_animation_player.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cwj0jaw6impcj
|
||||||
@@ -43,14 +43,16 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
cylinder.rotation_degrees = lerp(cylinder.rotation_degrees,Vector3(30 + current_round*60,90,90), delta / 0.1 )
|
cylinder.rotation_degrees = lerp(cylinder.rotation_degrees,Vector3(30 + current_round*60,90,90), delta / 0.1 )
|
||||||
|
|
||||||
rotation_degrees = lerp(rotation_degrees, target_angle, delta / 0.1)
|
#rotation_degrees = lerp(rotation_degrees, target_angle, delta / 0.1)
|
||||||
|
|
||||||
if state == revolver_state.UP:
|
if state == revolver_state.UP:
|
||||||
global_position = lerp(global_position, up_pos, delta/ 0.1)
|
#global_position = lerp(global_position, up_pos, delta/ 0.1)
|
||||||
target_angle = target_angle_up
|
#target_angle = target_angle_up
|
||||||
|
pass
|
||||||
elif state == revolver_state.DOWN:
|
elif state == revolver_state.DOWN:
|
||||||
global_position = lerp(global_position, down_pos, delta / 0.1)
|
pass
|
||||||
target_angle = target_angle_down
|
#global_position = lerp(global_position, down_pos, delta / 0.1)
|
||||||
|
#target_angle = target_angle_down
|
||||||
#cylinder.rotation_degrees = Vector3(30 + current_round*60,90,90)
|
#cylinder.rotation_degrees = Vector3(30 + current_round*60,90,90)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user