Add loading screen
This commit is contained in:
parent
226d7cc5a0
commit
0139ebbd30
8 changed files with 243 additions and 0 deletions
86
Scenes/Loading.tscn
Normal file
86
Scenes/Loading.tscn
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://Scenes/Loading/LoadingScreen.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://Scenes/Loading/ScatterSource.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://UIAssets/Effects/radialfade.png" type="Texture" id=3]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=1]
|
||||||
|
resource_name = "fade_in"
|
||||||
|
length = 2.0
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("TextureRect:modulate")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.5, 0.8 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/path = NodePath("Cards")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ ],
|
||||||
|
"method": "scatter_in"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=2]
|
||||||
|
resource_name = "fade_out"
|
||||||
|
length = 2.0
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("TextureRect:modulate")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0.4, 0.7, 1.9 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/path = NodePath("Cards")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PoolRealArray( 0.2 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ ],
|
||||||
|
"method": "scatter_out"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="LoadingScreen" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Cards" type="Node2D" parent="."]
|
||||||
|
position = Vector2( 1280, 800 )
|
||||||
|
scale = Vector2( 0.5, 0.5 )
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
|
modulate = Color( 1, 1, 1, 0.784314 )
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
expand = true
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
anims/fade_in = SubResource( 1 )
|
||||||
|
anims/fade_out = SubResource( 2 )
|
13
Scenes/Loading/LoadingScreen.gd
Normal file
13
Scenes/Loading/LoadingScreen.gd
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
var passed := 0.0
|
||||||
|
var once := true
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$AnimationPlayer.play("fade_in")
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
passed += delta
|
||||||
|
if passed > 5.0 and once:
|
||||||
|
$AnimationPlayer.play("fade_out")
|
||||||
|
once = false
|
12
Scenes/Loading/ScatterCard.gd
Normal file
12
Scenes/Loading/ScatterCard.gd
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
extends Sprite
|
||||||
|
|
||||||
|
class_name ScatterCard
|
||||||
|
|
||||||
|
func tweenTo(targetPos: Vector2, targetRot: float, duration: float = 1.0):
|
||||||
|
$Tween.interpolate_property(self, "position",
|
||||||
|
position, targetPos, duration,
|
||||||
|
Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
$Tween.interpolate_property(self, "rotation",
|
||||||
|
rotation, targetRot, duration,
|
||||||
|
Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
$Tween.start()
|
12
Scenes/Loading/ScatterCard.tscn
Normal file
12
Scenes/Loading/ScatterCard.tscn
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://MLPAssets/Textures/CardBack.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://Scenes/Loading/ScatterCard.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[node name="ScatterCard" type="Sprite"]
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
region_enabled = true
|
||||||
|
region_rect = Rect2( 30, 6, 350, 500 )
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
80
Scenes/Loading/ScatterSource.gd
Normal file
80
Scenes/Loading/ScatterSource.gd
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
export var targetPosRot := [
|
||||||
|
Vector3(-2425.52002, -1513.22998, -0.682842),
|
||||||
|
Vector3(-1714.47998, -742.367004, 0.107902),
|
||||||
|
Vector3(-229.889008, -1378.040039, 0.107902),
|
||||||
|
Vector3(-1493.560059, -1456.449951, -1.13486),
|
||||||
|
Vector3(-757.916016, -681.47998, -0.297441),
|
||||||
|
Vector3(-1943.130005, -82.720901, -0.344115),
|
||||||
|
Vector3(-2418.840088, -1182.540039, -0.127431),
|
||||||
|
Vector3(-1613.47998, -497.794006, 0.663313),
|
||||||
|
Vector3(-192.798004, -1129.569946, 0.663313),
|
||||||
|
Vector3(-1486.880005, -1125.75, -0.579449),
|
||||||
|
Vector3(-576.434021, -112.779999, -0.579449),
|
||||||
|
Vector3(-755.335022, -350.783997, 0.211295),
|
||||||
|
Vector3(-1861, -1473.150024, -0.120897),
|
||||||
|
Vector3(-1125.359985, -698.182007, 0.669847),
|
||||||
|
Vector3(-2253.439941, -172.882996, 0.669847),
|
||||||
|
Vector3(-854.388977, -1449.02002, -0.572915),
|
||||||
|
Vector3(-197.494995, -641.395996, 0.217829),
|
||||||
|
Vector3(-1846.109985, -1109.640015, 0.604969),
|
||||||
|
Vector3(-1122.780029, -367.484985, 1.39571),
|
||||||
|
Vector3(-1390.01001, -1346.209961, 0.604969),
|
||||||
|
Vector3(-594.39502, -292.231995, 0.604969),
|
||||||
|
Vector3(-658.466003, -571.247986, 1.39571),
|
||||||
|
Vector3(-922.354004, -1085.660034, 0.152952),
|
||||||
|
Vector3(-1967.660034, -391.760986, 0.152952),
|
||||||
|
Vector3(-507.67099, -1035.630005, 0.152952),
|
||||||
|
Vector3(-231.824997, -286.092987, 0.943696),
|
||||||
|
Vector3(-1625.719971, -149.938004, 0.328764),
|
||||||
|
Vector3(-2111.530029, -1566.680054, -0.586263),
|
||||||
|
Vector3(-2408.820068, -888.583008, -1.19034),
|
||||||
|
Vector3(-1367.680054, -795.814026, 0.204481),
|
||||||
|
Vector3(92.306602, -1439.689941, 0.204481),
|
||||||
|
Vector3(-2095.879883, -572.008972, 0.204481),
|
||||||
|
Vector3(-1427.400024, -198.809998, -0.657498),
|
||||||
|
Vector3(-1179.560059, -1509.890015, -1.03828),
|
||||||
|
Vector3(-2015.709961, -869.302002, -1.03828),
|
||||||
|
Vector3(-555.723999, -1513.170044, -1.03828),
|
||||||
|
Vector3(-443.921997, -734.927002, -0.247536),
|
||||||
|
Vector3(-1629.140015, -136.167007, -0.247536),
|
||||||
|
Vector3(-1099.619995, -118.944, 0.149231),
|
||||||
|
Vector3(-2104.840088, -1235.97998, 0.139604),
|
||||||
|
Vector3(-2503.679932, -573.754028, -0.464474),
|
||||||
|
Vector3(-1361, -465.118011, 0.930348),
|
||||||
|
Vector3(98.987801, -1108.98999, 0.930348),
|
||||||
|
Vector3(-2476.290039, -155.207001, 0.930348),
|
||||||
|
Vector3(-1168.780029, -1179.189941, -0.141957),
|
||||||
|
Vector3(-291.14801, -71.900101, -0.141957),
|
||||||
|
Vector3(-2304.780029, -596.840027, -0.141957),
|
||||||
|
Vector3(-441.34201, -404.230011, 0.648787),
|
||||||
|
Vector3(-1690.640015, -1409.680054, -1.13599),
|
||||||
|
Vector3(-913.987976, -671.625, -0.345251),
|
||||||
|
Vector3(-2099.199951, -72.866203, -0.345251),
|
||||||
|
Vector3(-126.578003, -946.398987, -0.345251),
|
||||||
|
Vector3(-758.677979, -1352.890015, -1.58801),
|
||||||
|
Vector3(-27.137899, -577.929016, -0.797268),
|
||||||
|
Vector3(-1683.959961, -1078.97998, -0.410128),
|
||||||
|
Vector3(-851.437988, -61.913799, -0.410128),
|
||||||
|
Vector3(-952.419006, -304.019012, 0.20453),
|
||||||
|
Vector3(-747.895996, -1022.200012, -0.862145),
|
||||||
|
Vector3(-1933.109985, -423.437988, -0.506863),
|
||||||
|
Vector3(-24.5581, -193.917999, -0.071401)
|
||||||
|
]
|
||||||
|
|
||||||
|
export var cardTemplate : PackedScene = preload("res://Scenes/Loading/ScatterCard.tscn")
|
||||||
|
|
||||||
|
func scatter_in():
|
||||||
|
var index := 0
|
||||||
|
for tpr in targetPosRot:
|
||||||
|
var card: ScatterCard = cardTemplate.instance()
|
||||||
|
card.position = Vector2(200 + index * 3, 150 + index * 5)
|
||||||
|
card.rotation = -PI
|
||||||
|
add_child(card)
|
||||||
|
card.tweenTo(Vector2(tpr.x, tpr.y), tpr.z)
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
func scatter_out():
|
||||||
|
for card in get_children():
|
||||||
|
card.tweenTo(Vector2((card.position.x / 2)-3000, (card.position.y)-1800), PI)
|
BIN
UIAssets/Effects/radialfade.png
Normal file
BIN
UIAssets/Effects/radialfade.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 170 KiB |
34
UIAssets/Effects/radialfade.png.import
Normal file
34
UIAssets/Effects/radialfade.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/radialfade.png-49d21b2d4297b6db11e0e7c2b2b960be.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://UIAssets/Effects/radialfade.png"
|
||||||
|
dest_files=[ "res://.import/radialfade.png-49d21b2d4297b6db11e0e7c2b2b960be.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
|
@ -24,6 +24,11 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://Classes/Utils/Resources.gd"
|
"path": "res://Classes/Utils/Resources.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Sprite",
|
||||||
|
"class": "ScatterCard",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://Scenes/Loading/ScatterCard.gd"
|
||||||
|
}, {
|
||||||
"base": "Area",
|
"base": "Area",
|
||||||
"class": "Stack",
|
"class": "Stack",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
@ -33,6 +38,7 @@ _global_script_class_icons={
|
||||||
"Board": "",
|
"Board": "",
|
||||||
"Card": "",
|
"Card": "",
|
||||||
"Resources": "",
|
"Resources": "",
|
||||||
|
"ScatterCard": "",
|
||||||
"Stack": ""
|
"Stack": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue