From 4df78a4ccfd64bce3916c85ded3e97ec9b5ae99e Mon Sep 17 00:00:00 2001 From: Evgenij Titarenko Date: Sun, 25 Aug 2024 23:12:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=BB=D0=B8=D0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prefabs/SceneManager.tscn | 1 + resources/sprites/ui/theend.png | Bin 0 -> 4734 bytes resources/sprites/ui/theend.png.import | 34 ++++++++++++ scenes/Day5.tscn | 2 +- scenes/Startup.tscn | 3 +- scenes/TheEnd.tscn | 69 +++++++++++++++++++++++ scripts/Startup.cs | 27 ++++++++- scripts/TheEnd.cs | 73 +++++++++++++++++++++++++ 8 files changed, 204 insertions(+), 5 deletions(-) create mode 100644 resources/sprites/ui/theend.png create mode 100644 resources/sprites/ui/theend.png.import create mode 100644 scenes/TheEnd.tscn create mode 100644 scripts/TheEnd.cs diff --git a/prefabs/SceneManager.tscn b/prefabs/SceneManager.tscn index 56b3c47..f907212 100644 --- a/prefabs/SceneManager.tscn +++ b/prefabs/SceneManager.tscn @@ -10,5 +10,6 @@ Scenes = { "Day3": "res://scenes/Day3.tscn", "Day4": "res://scenes/Day4.tscn", "Day5": "res://scenes/Day5.tscn", +"End": "res://scenes/TheEnd.tscn", "Menu": "res://scenes/Startup.tscn" } diff --git a/resources/sprites/ui/theend.png b/resources/sprites/ui/theend.png new file mode 100644 index 0000000000000000000000000000000000000000..924c097cd902c6f72ff99eaf0f53923dc87a4773 GIT binary patch literal 4734 zcmYLNdpwj`+<(SsjWDBOyBe1@$m`xxxsIriTd6Ifu(@TjY_8ETN$h4d8HII^+|r=L z7#Sn9Qb}^lbtsn^W5y+8n49;R_WkVp$2{kE&ipRl^ZR|zdCqzMJniP7uyg-T000!6 z9FKbd0K^uQS71MY&)*HGSg?UadN|ktwI5WN0DwH|bo|)4xB_-zZ>WmX?mPDTx&=Knvhl&)gad%Fx}kSC5OSMVC;s^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AqO0t-v^`d5vy{b^ z!-X$YX8HB7-Ke$3W?Li$TKR13x+$eA@8Yudm62Q>hlXy`Lx2KSAcQjiFrb(N#oPGI#oip!9im|2e*AF&EOtank z(fDETUTNyU>C*AE6pY(T75vKl5=2Qdw@I-2i2?Mxa;F;dy}GqA*2>sPdRgHNSe{M^ zGgR#2%({3!4xVL7@1wUP1!&ukDh5Q~be8zk*Ei93%5=J4!xbOD@~R9Ob!YOWDa7K| z2yY#Ffd#jvqYRv!^S#}w1ZD94J9PSgR%M%rzJy7->V4st-?IS&tvkDfXVx>FE#{*_ z*T!2oeOcKW4+Ra~MZ{vfH0r#R4JTBKBW$LtvTUK z_MXzgWL(Cq_V3ix!9Zjqpy%(Mqi&g5V0v|nxhIT@t&0ZuJcDaVa4`Ppu?3lUh^%73 zjzTqtEZX+I0?85+E>b>-K&rn<&Mu^bvz4d0)Q{=rfUc*Fy|gf?sz-Ms)sLo36c!Ih z3cJ4+%VX~EK-)&Z%m&o#5wkzYDlYv~G(#qTyRvx;sSZiLq`n0~fNj9+-o$54_h)2I zB}>DIXY@oSLffnNfn&&faEt}UPZB(3Ka(&c6M9P;mglDjkva`U+bSxwV5Sw&wx^YK zi`fddW@HvY>(Vp)?bW%Or?z3B{f}KYYu>Hbkbo)(QvDCR3^73(7J3`}itvTO6F^QY zfj;gO$VRZY*Fg|@;LmkdJe(>)SPp>!l(wN#M)uA%7d2+U4@!X33Af|5 Ic7DnK3&GS^IsgCw literal 0 HcmV?d00001 diff --git a/resources/sprites/ui/theend.png.import b/resources/sprites/ui/theend.png.import new file mode 100644 index 0000000..1f1159e --- /dev/null +++ b/resources/sprites/ui/theend.png.import @@ -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 diff --git a/scenes/Day5.tscn b/scenes/Day5.tscn index 6a8f8f5..f3bf03e 100644 --- a/scenes/Day5.tscn +++ b/scenes/Day5.tscn @@ -55,7 +55,7 @@ stream_0 = ExtResource("10_bwdem") [node name="Test" type="Node2D"] script = ExtResource("1_ii8yu") -NextScene = "Menu" +NextScene = "End" IsEngineDisabled = false [node name="Sprite2D" type="Sprite2D" parent="."] diff --git a/scenes/Startup.tscn b/scenes/Startup.tscn index cf18a3a..e96cb9a 100644 --- a/scenes/Startup.tscn +++ b/scenes/Startup.tscn @@ -39,9 +39,10 @@ offset_left = -160.0 offset_top = -120.0 offset_right = 160.0 offset_bottom = 120.0 -color = Color(0, 0, 0, 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" diff --git a/scenes/TheEnd.tscn b/scenes/TheEnd.tscn new file mode 100644 index 0000000..50e0ae0 --- /dev/null +++ b/scenes/TheEnd.tscn @@ -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" diff --git a/scripts/Startup.cs b/scripts/Startup.cs index d64d0fd..dda4de2 100644 --- a/scripts/Startup.cs +++ b/scripts/Startup.cs @@ -6,7 +6,8 @@ public partial class Startup : Node2D private enum State { Default, - Transition + TransitionIn, + TransitionOut } private State _state = State.Default; @@ -22,12 +23,13 @@ public partial class Startup : Node2D { _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.Transition) + if (_state == State.TransitionOut) { _transitionTimeout += delta; // _colorRect.Color = _colorRect.Color.Lerp(new Color(0, 0, 0, 255), (float)_transitionTimeout/2); @@ -38,13 +40,32 @@ public partial class Startup : Node2D GetNode("/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) { if (@event.IsActionPressed("Interact")) { - _state = State.Transition; + _state = State.TransitionOut; + } + if (@event.IsActionPressed("ui_cancel")) + { + GetTree().Quit(); } } } diff --git a/scripts/TheEnd.cs b/scripts/TheEnd.cs new file mode 100644 index 0000000..5628fcf --- /dev/null +++ b/scripts/TheEnd.cs @@ -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("/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(); + } + } +}