Improve card run animation

This commit is contained in:
CactiChameleon9 2022-07-30 15:35:51 +01:00
parent 7040c0e09d
commit 53462325c8
5 changed files with 116 additions and 9 deletions

View File

@ -12,6 +12,7 @@ script = ExtResource( 1 )
[node name="Scroll" type="ScrollContainer" parent="."] [node name="Scroll" type="ScrollContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
rect_clip_content = false
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
scroll_horizontal_enabled = false scroll_horizontal_enabled = false

64
TempBattle.tscn Normal file
View File

@ -0,0 +1,64 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Characters/Character.gd" type="Script" id=1]
[ext_resource path="res://UI/CardContainer.tscn" type="PackedScene" id=2]
[ext_resource path="res://UI/Card.gd" type="Script" id=3]
[ext_resource path="res://Assets/CardDB/Broadsword.tres" type="Resource" id=4]
[ext_resource path="res://Assets/CardDB/Poisonous apple.tres" type="Resource" id=5]
[ext_resource path="res://Assets/CardDB/Magic Carving Knife.tres" type="Resource" id=6]
[sub_resource type="GDScript" id=1]
script/source = "extends Node2D
func _ready():
$CanvasLayer/CardContainer.character = $Character
yield(get_tree().create_timer(1), \"timeout\")
$Character/Card2.run_card()
yield(get_tree().create_timer(5), \"timeout\")
$CanvasLayer/CardContainer.character = $Character2
yield(get_tree().create_timer(5), \"timeout\")
$Character2/Card4.run_card()
"
[node name="TempBattle" type="Node2D"]
script = SubResource( 1 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="CardContainer" parent="CanvasLayer" instance=ExtResource( 2 )]
margin_top = 317.0
margin_right = -321.0
[node name="Character" type="Node2D" parent="."]
script = ExtResource( 1 )
[node name="Card1" type="Node" parent="Character"]
script = ExtResource( 3 )
card_info = ExtResource( 4 )
[node name="Card2" type="Node" parent="Character"]
script = ExtResource( 3 )
card_info = ExtResource( 5 )
[node name="Card3" type="Node" parent="Character"]
script = ExtResource( 3 )
[node name="Character2" type="Node2D" parent="."]
script = ExtResource( 1 )
[node name="Card4" type="Node" parent="Character2"]
script = ExtResource( 3 )
card_info = ExtResource( 4 )
[node name="Card5" type="Node" parent="Character2"]
script = ExtResource( 3 )
card_info = ExtResource( 5 )
[node name="Card6" type="Node" parent="Character2"]
script = ExtResource( 3 )
card_info = ExtResource( 6 )
[node name="Character3" type="Node2D" parent="."]
script = ExtResource( 1 )

View File

@ -1,4 +1,3 @@
tool
extends Control extends Control
signal card_view_removed(card_view) signal card_view_removed(card_view)
@ -81,8 +80,7 @@ func card_view_run(do_emit_signal : bool = true):
if do_emit_signal: emit_signal("card_view_removed", self) if do_emit_signal: emit_signal("card_view_removed", self)
# play the disappearing input dice animation # play the disappearing input dice animation
for i in input_dice_views: play_input_dice_animations()
yield(i.run_disappear_animation(), "completed")
# play the using animation # play the using animation
$AnimationPlayer.play("Fly Off") $AnimationPlayer.play("Fly Off")
@ -104,6 +102,11 @@ func card_view_remove(do_emit_signal : bool = true):
queue_free() queue_free()
func play_input_dice_animations():
for i in input_dice_views:
i.run_disappear_animation()
func disconnect_signals(): func disconnect_signals():
if card.get_signal_connection_list("card_removed") == []: if card.get_signal_connection_list("card_removed") == []:
return return

View File

@ -42,7 +42,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id=7] [sub_resource type="Animation" id=7]
resource_name = "Fly Off" resource_name = "Fly Off"
length = 0.5 length = 1.5
step = 0.01 step = 0.01
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/path = NodePath("LocalPosition:rect_position") tracks/0/path = NodePath("LocalPosition:rect_position")
@ -51,10 +51,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 0.5 ), "times": PoolRealArray( 0, 0.4, 0.65, 1.3 ),
"transitions": PoolRealArray( 5, 1 ), "transitions": PoolRealArray( 0.647041, 0.647041, 4, 1 ),
"update": 0, "update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -999 ) ] "values": [ Vector2( 0, 0 ), Vector2( 0, 0 ), Vector2( 0, 20 ), Vector2( 0, -700 ) ]
} }
tracks/1/type = "value" tracks/1/type = "value"
tracks/1/path = NodePath(".:rect_scale") tracks/1/path = NodePath(".:rect_scale")
@ -63,11 +63,25 @@ tracks/1/loop_wrap = true
tracks/1/imported = false tracks/1/imported = false
tracks/1/enabled = true tracks/1/enabled = true
tracks/1/keys = { tracks/1/keys = {
"times": PoolRealArray( 0, 0.18, 0.5 ), "times": PoolRealArray( 0, 0.65, 1.3 ),
"transitions": PoolRealArray( 1, 6.06286, 1 ), "transitions": PoolRealArray( 1, 6.06286, 1 ),
"update": 0, "update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1.4 ) ] "values": [ Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1.4 ) ]
} }
tracks/2/type = "method"
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "play_input_dice_animations"
} ]
}
[sub_resource type="Animation" id=8] [sub_resource type="Animation" id=8]
length = 0.001 length = 0.001
@ -108,6 +122,7 @@ script = ExtResource( 1 )
[node name="LocalPosition" type="Control" parent="."] [node name="LocalPosition" type="Control" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_bottom = 6.10352e-05
[node name="Background" type="PanelContainer" parent="LocalPosition"] [node name="Background" type="PanelContainer" parent="LocalPosition"]
unique_name_in_owner = true unique_name_in_owner = true

View File

@ -71,6 +71,18 @@ tracks/2/keys = {
"update": 1, "update": 1,
"values": [ false, true ] "values": [ false, true ]
} }
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite/ExtraInfo:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 0.25 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[sub_resource type="Animation" id=9] [sub_resource type="Animation" id=9]
length = 0.001 length = 0.001
@ -110,6 +122,18 @@ tracks/2/keys = {
"update": 0, "update": 0,
"values": [ false ] "values": [ false ]
} }
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite/ExtraInfo:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ) ]
}
[node name="InputDiceView" type="Control"] [node name="InputDiceView" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -140,7 +164,7 @@ texture = ExtResource( 2 )
expand = true expand = true
stretch_mode = 6 stretch_mode = 6
[node name="ExtraInfo" type="Label" parent="."] [node name="ExtraInfo" type="Label" parent="Sprite"]
unique_name_in_owner = true unique_name_in_owner = true
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0