implement splash screens

This commit is contained in:
Haze Weathers 2023-12-25 15:11:59 -05:00
parent 515434c70c
commit ac36644d70
8 changed files with 139 additions and 1 deletions

38
menus/splash_screen.gd Normal file
View file

@ -0,0 +1,38 @@
extends Control
export var next_screen: PackedScene
var skipping: bool = false
onready var team_sg: TextureRect = $TeamSG
onready var godot: TextureRect = $Godot
func _ready() -> void:
yield(get_tree().create_timer(0.5), "timeout")
Fade.fade_out(0.4)
yield(Fade, "fade_finished")
team_sg.visible = true
Fade.fade_in(0.4)
yield(Fade, "fade_finished")
yield(get_tree().create_timer(1.0), "timeout")
Fade.fade_out(0.4)
yield(Fade, "fade_finished")
yield(get_tree().create_timer(0.5), "timeout")
godot.visible = true
Fade.fade_in(0.4)
yield(Fade, "fade_finished")
yield(get_tree().create_timer(1.0), "timeout")
Fade.fade_out(0.4)
yield(Fade, "fade_finished")
_next_screen()
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"):
skipping = true
Fade.fade_out(0.4)
yield(Fade, "fade_finished")
_next_screen()
free()
func _next_screen() -> void:
SceneManager.current_scene = next_screen.instance()

29
menus/splash_screen.tscn Normal file
View file

@ -0,0 +1,29 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://graphics/hud/team_sg_splash.png" type="Texture" id=1]
[ext_resource path="res://menus/splash_screen.gd" type="Script" id=2]
[ext_resource path="res://graphics/hud/godot_splash.png" type="Texture" id=3]
[ext_resource path="res://menus/title_screen.tscn" type="PackedScene" id=4]
[node name="SplashScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
next_screen = ExtResource( 4 )
[node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0, 0, 0, 1 )
[node name="TeamSG" type="TextureRect" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
[node name="Godot" type="TextureRect" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 3 )

View file

@ -9,6 +9,7 @@ func _input(event):
$AnimationPlayer.play("activate")
func _ready():
Fade.fade_in(0.4)
var time = OS.get_time()
if time.hour >= 18 or time.hour < 6:
$Night.visible = true