Релиз

This commit is contained in:
Евгений Титаренко 2024-08-25 23:12:57 +03:00
parent 920f05b3a3
commit 4df78a4ccf
8 changed files with 204 additions and 5 deletions

View file

@ -10,5 +10,6 @@ Scenes = {
"Day3": "res://scenes/Day3.tscn", "Day3": "res://scenes/Day3.tscn",
"Day4": "res://scenes/Day4.tscn", "Day4": "res://scenes/Day4.tscn",
"Day5": "res://scenes/Day5.tscn", "Day5": "res://scenes/Day5.tscn",
"End": "res://scenes/TheEnd.tscn",
"Menu": "res://scenes/Startup.tscn" "Menu": "res://scenes/Startup.tscn"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://df3sxyo0xp880"
path="res://.godot/imported/theend.png-c5d8845d007addc993cbab5011215ccd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/sprites/ui/theend.png"
dest_files=["res://.godot/imported/theend.png-c5d8845d007addc993cbab5011215ccd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -55,7 +55,7 @@ stream_0 = ExtResource("10_bwdem")
[node name="Test" type="Node2D"] [node name="Test" type="Node2D"]
script = ExtResource("1_ii8yu") script = ExtResource("1_ii8yu")
NextScene = "Menu" NextScene = "End"
IsEngineDisabled = false IsEngineDisabled = false
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]

View file

@ -39,9 +39,10 @@ offset_left = -160.0
offset_top = -120.0 offset_top = -120.0
offset_right = 160.0 offset_right = 160.0
offset_bottom = 120.0 offset_bottom = 120.0
color = Color(0, 0, 0, 0) color = Color(0, 0, 0, 1)
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamPlaylist_5mfcs") stream = SubResource("AudioStreamPlaylist_5mfcs")
volume_db = -40.0
autoplay = true autoplay = true
bus = &"Music" bus = &"Music"

69
scenes/TheEnd.tscn Normal file
View file

@ -0,0 +1,69 @@
[gd_scene load_steps=6 format=3 uid="uid://1cbr4hkp06gi"]
[ext_resource type="Script" path="res://scripts/TheEnd.cs" id="1_e2ali"]
[ext_resource type="Texture2D" uid="uid://df3sxyo0xp880" path="res://resources/sprites/ui/theend.png" id="2_io7t6"]
[ext_resource type="FontFile" uid="uid://dwn20pw40jpxm" path="res://fonts/ZxSpectrum7-nROZ0.ttf" id="3_m0xo0"]
[ext_resource type="AudioStream" uid="uid://be35iuapayv0u" path="res://resources/music/Day1.wav" id="4_4fjbh"]
[sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_5mfcs"]
stream_count = 1
stream_0 = ExtResource("4_4fjbh")
[node name="TheEnd" type="Node2D"]
script = ExtResource("1_e2ali")
[node name="Camera2D" type="Camera2D" parent="."]
zoom = Vector2(2, 2)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_io7t6")
[node name="Label" type="Label" parent="."]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -56.0
offset_top = 24.0
offset_right = 56.0
offset_bottom = 44.0
grow_horizontal = 2
theme_override_fonts/font = ExtResource("3_m0xo0")
theme_override_font_sizes/font_size = 25
text = "THE END"
[node name="Label2" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -136.0
offset_top = -101.5
offset_right = 136.0
offset_bottom = -26.5
grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource("3_m0xo0")
theme_override_font_sizes/font_size = 10
text = "The submarine went radio
silent for six days. The last
signal received by HQ contained nothing
but the mumblings of the captain.
Operation \"The Unnameable\"
was canned until better times."
horizontal_alignment = 1
[node name="ColorRect" type="ColorRect" parent="."]
visible = false
offset_left = -160.0
offset_top = -120.0
offset_right = 160.0
offset_bottom = 120.0
color = Color(0, 0, 0, 1)
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamPlaylist_5mfcs")
volume_db = -40.0
autoplay = true
bus = &"Music"

View file

@ -6,7 +6,8 @@ public partial class Startup : Node2D
private enum State private enum State
{ {
Default, Default,
Transition TransitionIn,
TransitionOut
} }
private State _state = State.Default; private State _state = State.Default;
@ -22,12 +23,13 @@ public partial class Startup : Node2D
{ {
_colorRect = (ColorRect)FindChild("ColorRect"); _colorRect = (ColorRect)FindChild("ColorRect");
_music = (AudioStreamPlayer)FindChild("AudioStreamPlayer"); _music = (AudioStreamPlayer)FindChild("AudioStreamPlayer");
_state = State.TransitionIn;
} }
// Called every frame. 'delta' is the elapsed time since the previous frame. // Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
{ {
if (_state == State.Transition) if (_state == State.TransitionOut)
{ {
_transitionTimeout += delta; _transitionTimeout += delta;
// _colorRect.Color = _colorRect.Color.Lerp(new Color(0, 0, 0, 255), (float)_transitionTimeout/2); // _colorRect.Color = _colorRect.Color.Lerp(new Color(0, 0, 0, 255), (float)_transitionTimeout/2);
@ -38,13 +40,32 @@ public partial class Startup : Node2D
GetNode<SceneManager>("/root/SceneManager").SwitchScene("Day1"); GetNode<SceneManager>("/root/SceneManager").SwitchScene("Day1");
} }
} }
if (_state == State.TransitionIn)
{
if (_transitionTimeout < 2)
{
_transitionTimeout += delta;
// _colorRect.Color = _colorRect.Color.Lerp(new Color(0, 0, 0, 255), (float)_transitionTimeout/2);
_colorRect.Color = new Color(0, 0, 0, Mathf.Lerp(1, 0, (float)_transitionTimeout/2));
_music.VolumeDb = Mathf.Lerp(-40, 0, (float)_transitionTimeout/2);
}
else
{
_state = State.Default;
_transitionTimeout = 0;
}
}
} }
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
if (@event.IsActionPressed("Interact")) if (@event.IsActionPressed("Interact"))
{ {
_state = State.Transition; _state = State.TransitionOut;
}
if (@event.IsActionPressed("ui_cancel"))
{
GetTree().Quit();
} }
} }
} }

73
scripts/TheEnd.cs Normal file
View file

@ -0,0 +1,73 @@
using Godot;
using System;
public partial class TheEnd : Node2D
{
private enum State
{
Default,
TransitionIn,
TransitionOut
}
private State _state = State.Default;
private ColorRect _colorRect;
private AudioStreamPlayer _music;
private double _transitionTimeout = 0;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_colorRect = (ColorRect)FindChild("ColorRect");
_music = (AudioStreamPlayer)FindChild("AudioStreamPlayer");
_state = State.TransitionIn;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _PhysicsProcess(double delta)
{
if (_state == State.TransitionOut)
{
_transitionTimeout += delta;
// _colorRect.Color = _colorRect.Color.Lerp(new Color(0, 0, 0, 255), (float)_transitionTimeout/2);
_colorRect.Color = new Color(0, 0, 0, Mathf.Lerp(0, 1, (float)_transitionTimeout/2));
_music.VolumeDb = Mathf.Lerp(0, -41, (float)_transitionTimeout/2);
if (_music.VolumeDb < -40)
{
GetNode<SceneManager>("/root/SceneManager").SwitchScene("Menu");
}
}
if (_state == State.TransitionIn)
{
if (_transitionTimeout < 2)
{
_transitionTimeout += delta;
// _colorRect.Color = _colorRect.Color.Lerp(new Color(0, 0, 0, 255), (float)_transitionTimeout/2);
_colorRect.Color = new Color(0, 0, 0, Mathf.Lerp(1, 0, (float)_transitionTimeout/2));
_music.VolumeDb = Mathf.Lerp(-40, 0, (float)_transitionTimeout/2);
}
else
{
_state = State.Default;
_transitionTimeout = 0;
}
}
}
public override void _Input(InputEvent @event)
{
if (@event.IsActionPressed("Interact"))
{
_transitionTimeout = 0;
_state = State.TransitionOut;
}
if (@event.IsActionPressed("ui_cancel"))
{
GetTree().Quit();
}
}
}