generated from krampus/template-godot4
Shot setup arrow hides/shows with a little bounce
This commit is contained in:
parent
2065d7d832
commit
f1a6b9272d
|
@ -50,7 +50,9 @@ var _returning_free_camera := false
|
|||
@onready var direction: Node3D = %Direction
|
||||
@onready var pitch: Node3D = %Pitch
|
||||
@onready var camera: Camera3D = %Camera
|
||||
|
||||
@onready var arrow: Node3D = %Arrow
|
||||
@onready var arrow_animation: AnimationPlayer = %ArrowAnimation
|
||||
|
||||
@onready var power_bar: ProgressBar = %PowerBar
|
||||
@onready var power_animation: AnimationPlayer = %PowerAnimation
|
||||
|
@ -61,6 +63,8 @@ var _returning_free_camera := false
|
|||
@onready var camera_distance := camera.position.z:
|
||||
set = _set_camera_distance
|
||||
|
||||
@onready var phys_ball := preload("res://src/player/physics_ball/physics_ball.tscn")
|
||||
|
||||
@onready var _target_rotation := Vector2(pitch.rotation.x, direction.rotation.y)
|
||||
|
||||
|
||||
|
@ -118,6 +122,7 @@ func _on_phase_change(new_phase: Phase) -> void:
|
|||
|
||||
|
||||
func insert_free_cam() -> void:
|
||||
arrow_animation.play("hide")
|
||||
_free_camera = FreeCamera.create(camera)
|
||||
add_sibling(_free_camera)
|
||||
control_disabled = true
|
||||
|
@ -125,6 +130,7 @@ func insert_free_cam() -> void:
|
|||
|
||||
func return_free_cam() -> void:
|
||||
# TODO alter shot aim based on free camera selection
|
||||
arrow_animation.play("show")
|
||||
_free_camera.queue_free()
|
||||
_free_camera = null
|
||||
control_disabled = false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://cy7t2tc4y3b4"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://cy7t2tc4y3b4"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2k88ns0h5ie1" path="res://src/ui/arrow.tscn" id="2_s70wl"]
|
||||
|
@ -9,6 +9,97 @@ height = 0.1
|
|||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_5uovl"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dku72"]
|
||||
resource_name = "show"
|
||||
length = 0.42
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.233333, 0.366667, 0.42),
|
||||
"transitions": PackedFloat32Array(0.618, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.001, 0.001, 0.001), Vector3(1.1, 1.1, 1.1), Vector3(0.95, 0.95, 0.95), Vector3(1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ug2a7"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0.001, 0.001, 0.001)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3obkd"]
|
||||
resource_name = "hide"
|
||||
length = 0.42
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.42),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:scale")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.42),
|
||||
"transitions": PackedFloat32Array(1.618, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(1, 1, 1), Vector3(0.001, 0.001, 0.001)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rw0cf"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_ug2a7"),
|
||||
"hide": SubResource("Animation_3obkd"),
|
||||
"show": SubResource("Animation_dku72")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_pk1s7"]
|
||||
length = 0.001
|
||||
tracks/0/type = "bezier"
|
||||
|
@ -105,12 +196,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6)
|
|||
|
||||
[node name="Arrow" type="Node3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 0.337095, 0.941471, 0, -0.941471, 0.337095, 0, 0.1, 0)
|
||||
transform = Transform3D(0.001, 0, 0, 0, 0.000337095, 0.000941471, 0, -0.000941471, 0.000337095, 0, 0.1, 0)
|
||||
|
||||
[node name="ArrowMesh" parent="Arrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 1, 0, 0, 0, 0.2, 0, 1, 0)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="ArrowAnimation" type="AnimationPlayer" parent="Arrow"]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_rw0cf")
|
||||
}
|
||||
autoplay = "show"
|
||||
|
||||
[node name="ShotUI" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
Loading…
Reference in New Issue