better labels
This commit is contained in:
parent
72514d01c4
commit
49fe37d568
@ -1,10 +1,10 @@
|
|||||||
[gd_scene load_steps=10 format=3 uid="uid://4tym1auav4yv"]
|
[gd_scene load_steps=10 format=3 uid="uid://4tym1auav4yv"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://menu/start_game_menu.cs" id="1_0k2xm"]
|
[ext_resource type="Script" path="res://menu/start_game_menu.cs" id="1_0k2xm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b44vs2lwgnh37" path="res://images/mushroom_cloud001.webp" id="2_aky60"]
|
[ext_resource type="Texture2D" uid="uid://bd7j1ug5gs26w" path="res://images/mushroom_cloud001.webp" id="2_aky60"]
|
||||||
[ext_resource type="AudioStream" uid="uid://ckg5eypyrhidg" path="res://music/I Feel Grunge (Slow).wav" id="2_yw57x"]
|
[ext_resource type="AudioStream" uid="uid://co52ygvp3wcra" path="res://music/I Feel Grunge (Slow).wav" id="2_yw57x"]
|
||||||
[ext_resource type="AudioStream" uid="uid://c8dcqkmytnyay" path="res://audio/btn.wav" id="4_fx2mk"]
|
[ext_resource type="AudioStream" uid="uid://ds7ec1n3pytnr" path="res://audio/btn.wav" id="4_fx2mk"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dja6tipmq1m8l" path="res://audio/dot.wav" id="5_y8gc7"]
|
[ext_resource type="AudioStream" uid="uid://cg78xtngxrjlg" path="res://audio/dot.wav" id="5_y8gc7"]
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_n38oc"]
|
[sub_resource type="LabelSettings" id="LabelSettings_n38oc"]
|
||||||
font_size = 290
|
font_size = 290
|
||||||
|
@ -24,7 +24,7 @@ public partial class player : Camera3D
|
|||||||
private TextureProgressBar _nuke, _pr, _kash;
|
private TextureProgressBar _nuke, _pr, _kash;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
private Label _chatter, _timer;
|
private Label _chatter, _timer, _pr_count, _nuke_count, _kash_count;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
private AudioStreamPlayer _sndChtr, _sndBtn;
|
private AudioStreamPlayer _sndChtr, _sndBtn;
|
||||||
@ -38,7 +38,7 @@ public partial class player : Camera3D
|
|||||||
private float Nukes { get => (float)_nuke.Value; set => _nuke.Value = value; }
|
private float Nukes { get => (float)_nuke.Value; set => _nuke.Value = value; }
|
||||||
private float PR { get => (float)_pr.Value; set => _pr.Value = value; }
|
private float PR { get => (float)_pr.Value; set => _pr.Value = value; }
|
||||||
private float Kash { get => (float)_kash.Value; set => _kash.Value = value; }
|
private float Kash { get => (float)_kash.Value; set => _kash.Value = value; }
|
||||||
private int KashFlow { get; set; }
|
private int KashFlow { get; set; } = 1;
|
||||||
private int GameTime { get; set; } = 60;
|
private int GameTime { get; set; } = 60;
|
||||||
|
|
||||||
private string Chatter
|
private string Chatter
|
||||||
@ -72,6 +72,8 @@ public partial class player : Camera3D
|
|||||||
_btnPR.Pressed += () => { _sndBtn.Play(); ChangeScore(5, 10, 0, 0); };
|
_btnPR.Pressed += () => { _sndBtn.Play(); ChangeScore(5, 10, 0, 0); };
|
||||||
_btnKashCow.Pressed += () => { _sndBtn.Play(); ChangeScore(6, 0, 0, 1); };
|
_btnKashCow.Pressed += () => { _sndBtn.Play(); ChangeScore(6, 0, 0, 1); };
|
||||||
Chatter = "The enemy is stockpiling weapons of mass destruction.";
|
Chatter = "The enemy is stockpiling weapons of mass destruction.";
|
||||||
|
|
||||||
|
SetBarLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
@ -156,15 +158,17 @@ public partial class player : Camera3D
|
|||||||
_wOut = true;
|
_wOut = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void CheckGame() {
|
private void CheckGame()
|
||||||
|
{
|
||||||
bool gameover = false;
|
bool gameover = false;
|
||||||
|
|
||||||
if (PR <= 0)
|
if (PR <= 0)
|
||||||
gameover = true;
|
gameover = true;
|
||||||
else if (Kash <= 0)
|
|
||||||
gameover = true;
|
|
||||||
else if (Nukes >= 100)
|
else if (Nukes >= 100)
|
||||||
|
{
|
||||||
|
_btnEnd.Disabled = false;
|
||||||
_btnEnd.Pressed += () => { _sndBtn.Play(); Nuke(); };
|
_btnEnd.Pressed += () => { _sndBtn.Play(); Nuke(); };
|
||||||
|
}
|
||||||
|
|
||||||
if (GameTime <= 0)
|
if (GameTime <= 0)
|
||||||
gameover = true;
|
gameover = true;
|
||||||
@ -173,32 +177,41 @@ public partial class player : Camera3D
|
|||||||
Chatter = "Game Over.";
|
Chatter = "Game Over.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeScore(int price, int pr, int nukes, int isCashCow) {
|
public void ChangeScore(int price, int pr, int nukes, int kashFlow = 0)
|
||||||
if (price > Kash) {
|
{
|
||||||
|
if (price > Kash)
|
||||||
|
{
|
||||||
Chatter = "Not enough money.";
|
Chatter = "Not enough money.";
|
||||||
CheckGame();
|
CheckGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCashCow > 1)
|
|
||||||
isCashCow = 1;
|
|
||||||
else if (isCashCow < -1)
|
|
||||||
isCashCow = -1;
|
|
||||||
|
|
||||||
Nukes += nukes;
|
Nukes += nukes;
|
||||||
PR += pr;
|
PR += pr;
|
||||||
Kash -= price;
|
Kash -= price;
|
||||||
KashFlow += isCashCow;
|
KashFlow += kashFlow;
|
||||||
|
|
||||||
|
SetBarLabels();
|
||||||
CheckGame();
|
CheckGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MakeMoney() {
|
private void MakeMoney()
|
||||||
Kash += KashFlow * 2;
|
{
|
||||||
|
Kash += KashFlow;
|
||||||
GameTime--;
|
GameTime--;
|
||||||
_timer.Set("text", GameTime.ToString());
|
_timer.Set("text", GameTime.ToString());
|
||||||
|
|
||||||
|
SetBarLabels();
|
||||||
CheckGame();
|
CheckGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetBarLabels()
|
||||||
|
{
|
||||||
|
_kash_count.Text = $"{Kash}M$({KashFlow}M$/s)";
|
||||||
|
_nuke_count.Text = $"{Nukes} Megatons";
|
||||||
|
_pr_count.Text = $"{PR}(%) Approval";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void HandleBuilding()
|
public void HandleBuilding()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[gd_scene load_steps=23 format=3 uid="uid://b5gb5paiupum"]
|
[gd_scene load_steps=25 format=3 uid="uid://b5gb5paiupum"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://player/player.cs" id="1_of2l4"]
|
[ext_resource type="Script" path="res://player/player.cs" id="1_of2l4"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dye3nhm41yk6r" path="res://audio/chatter.wav" id="2_sa1qd"]
|
[ext_resource type="AudioStream" uid="uid://07ben02qe8yc" path="res://audio/chatter.wav" id="2_sa1qd"]
|
||||||
[ext_resource type="AudioStream" uid="uid://c8dcqkmytnyay" path="res://audio/btn.wav" id="3_00x5l"]
|
[ext_resource type="AudioStream" uid="uid://ds7ec1n3pytnr" path="res://audio/btn.wav" id="3_00x5l"]
|
||||||
|
|
||||||
[sub_resource type="CameraAttributesPhysical" id="CameraAttributesPhysical_1ejpb"]
|
[sub_resource type="CameraAttributesPhysical" id="CameraAttributesPhysical_1ejpb"]
|
||||||
frustum_near = 0.032
|
frustum_near = 0.032
|
||||||
@ -33,6 +33,9 @@ gradient = SubResource("Gradient_dxeak")
|
|||||||
width = 24
|
width = 24
|
||||||
height = 255
|
height = 255
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_xdjlf"]
|
||||||
|
font_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_tpani"]
|
[sub_resource type="Gradient" id="Gradient_tpani"]
|
||||||
colors = PackedColorArray(0.893472, 0.979245, 1, 1, 0.347927, 0.885716, 1, 1)
|
colors = PackedColorArray(0.893472, 0.979245, 1, 1, 0.347927, 0.885716, 1, 1)
|
||||||
|
|
||||||
@ -65,17 +68,20 @@ gradient = SubResource("Gradient_od2su")
|
|||||||
width = 24
|
width = 24
|
||||||
height = 255
|
height = 255
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_2lyli"]
|
||||||
|
font_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_adeuk"]
|
[sub_resource type="LabelSettings" id="LabelSettings_adeuk"]
|
||||||
font_size = 12
|
font_size = 15
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_kxike"]
|
[sub_resource type="LabelSettings" id="LabelSettings_kxike"]
|
||||||
font_size = 25
|
font_size = 64
|
||||||
outline_size = 7
|
outline_size = 7
|
||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="SphereMesh" id="SphereMesh_mtv4x"]
|
[sub_resource type="SphereMesh" id="SphereMesh_mtv4x"]
|
||||||
|
|
||||||
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_timer", "_sndChtr", "_sndBtn", "_tmrChtr", "_tmrCashGen", "_btnEnd", "_btnNukes", "_btnPR", "_btnKashCow")]
|
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_timer", "_pr_count", "_nuke_count", "_kash_count", "_sndChtr", "_sndBtn", "_tmrChtr", "_tmrCashGen", "_btnEnd", "_btnNukes", "_btnPR", "_btnKashCow")]
|
||||||
attributes = SubResource("CameraAttributesPhysical_1ejpb")
|
attributes = SubResource("CameraAttributesPhysical_1ejpb")
|
||||||
script = ExtResource("1_of2l4")
|
script = ExtResource("1_of2l4")
|
||||||
_con = NodePath("HUD/Debug info/Label")
|
_con = NodePath("HUD/Debug info/Label")
|
||||||
@ -88,6 +94,9 @@ _pr = NodePath("HUD/Buttons and info/PrBar")
|
|||||||
_kash = NodePath("HUD/Buttons and info/KashBar")
|
_kash = NodePath("HUD/Buttons and info/KashBar")
|
||||||
_chatter = NodePath("HUD/lbl_Chatter")
|
_chatter = NodePath("HUD/lbl_Chatter")
|
||||||
_timer = NodePath("HUD/Time")
|
_timer = NodePath("HUD/Time")
|
||||||
|
_pr_count = NodePath("HUD/Buttons and info/PrBar/PrCount")
|
||||||
|
_nuke_count = NodePath("HUD/Buttons and info/NukeBar/NukeCount")
|
||||||
|
_kash_count = NodePath("HUD/Buttons and info/KashBar/KashCount")
|
||||||
_sndChtr = NodePath("snd_Chatter")
|
_sndChtr = NodePath("snd_Chatter")
|
||||||
_sndBtn = NodePath("snd_Button")
|
_sndBtn = NodePath("snd_Button")
|
||||||
_tmrChtr = NodePath("tmr_Chatter")
|
_tmrChtr = NodePath("tmr_Chatter")
|
||||||
@ -106,6 +115,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="Debug info" type="Control" parent="HUD"]
|
[node name="Debug info" type="Control" parent="HUD"]
|
||||||
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_left = 33.0
|
offset_left = 33.0
|
||||||
@ -168,6 +178,7 @@ offset_left = -132.0
|
|||||||
offset_top = -132.0
|
offset_top = -132.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
disabled = true
|
||||||
text = "Nuke Enemy"
|
text = "Nuke Enemy"
|
||||||
icon = SubResource("GradientTexture2D_y5odr")
|
icon = SubResource("GradientTexture2D_y5odr")
|
||||||
icon_alignment = 1
|
icon_alignment = 1
|
||||||
@ -185,7 +196,7 @@ offset_top = -132.0
|
|||||||
offset_right = -133.0
|
offset_right = -133.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
text = "BDE"
|
text = "Arms"
|
||||||
icon_alignment = 1
|
icon_alignment = 1
|
||||||
expand_icon = true
|
expand_icon = true
|
||||||
|
|
||||||
@ -241,6 +252,20 @@ fill_mode = 3
|
|||||||
texture_under = SubResource("GradientTexture2D_2xkee")
|
texture_under = SubResource("GradientTexture2D_2xkee")
|
||||||
texture_progress = SubResource("GradientTexture2D_d5w6a")
|
texture_progress = SubResource("GradientTexture2D_d5w6a")
|
||||||
|
|
||||||
|
[node name="NukeCount" type="Label" parent="HUD/Buttons and info/NukeBar"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 24.0
|
||||||
|
offset_top = -125.5
|
||||||
|
offset_right = 43.0
|
||||||
|
offset_bottom = -99.5
|
||||||
|
grow_vertical = 2
|
||||||
|
rotation = 1.57079
|
||||||
|
text = "69"
|
||||||
|
label_settings = SubResource("LabelSettings_xdjlf")
|
||||||
|
|
||||||
[node name="PrBar" type="TextureProgressBar" parent="HUD/Buttons and info"]
|
[node name="PrBar" type="TextureProgressBar" parent="HUD/Buttons and info"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
@ -262,6 +287,20 @@ fill_mode = 3
|
|||||||
texture_under = SubResource("GradientTexture2D_7myfq")
|
texture_under = SubResource("GradientTexture2D_7myfq")
|
||||||
texture_progress = SubResource("GradientTexture2D_kdame")
|
texture_progress = SubResource("GradientTexture2D_kdame")
|
||||||
|
|
||||||
|
[node name="PrCount" type="Label" parent="HUD/Buttons and info/PrBar"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 24.0
|
||||||
|
offset_top = -125.5
|
||||||
|
offset_right = 43.0
|
||||||
|
offset_bottom = -99.5
|
||||||
|
grow_vertical = 2
|
||||||
|
rotation = 1.57079
|
||||||
|
text = "69"
|
||||||
|
label_settings = SubResource("LabelSettings_xdjlf")
|
||||||
|
|
||||||
[node name="KashBar" type="TextureProgressBar" parent="HUD/Buttons and info"]
|
[node name="KashBar" type="TextureProgressBar" parent="HUD/Buttons and info"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
@ -269,9 +308,9 @@ anchor_left = 1.0
|
|||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_left = -81.0
|
offset_left = -79.0
|
||||||
offset_top = -392.0
|
offset_top = -392.0
|
||||||
offset_right = -57.0
|
offset_right = -55.0
|
||||||
offset_bottom = -137.0
|
offset_bottom = -137.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
@ -284,6 +323,20 @@ fill_mode = 3
|
|||||||
texture_under = SubResource("GradientTexture2D_18k81")
|
texture_under = SubResource("GradientTexture2D_18k81")
|
||||||
texture_progress = SubResource("GradientTexture2D_nfg3s")
|
texture_progress = SubResource("GradientTexture2D_nfg3s")
|
||||||
|
|
||||||
|
[node name="KashCount" type="Label" parent="HUD/Buttons and info/KashBar"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 24.0
|
||||||
|
offset_top = -125.5
|
||||||
|
offset_right = 47.0
|
||||||
|
offset_bottom = -99.5
|
||||||
|
grow_vertical = 2
|
||||||
|
rotation = 1.57079
|
||||||
|
text = "69 "
|
||||||
|
label_settings = SubResource("LabelSettings_xdjlf")
|
||||||
|
|
||||||
[node name="lbl_Nukes" type="Label" parent="HUD/Buttons and info"]
|
[node name="lbl_Nukes" type="Label" parent="HUD/Buttons and info"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
@ -300,6 +353,7 @@ grow_vertical = 0
|
|||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
text = "ARMS
|
text = "ARMS
|
||||||
"
|
"
|
||||||
|
label_settings = SubResource("LabelSettings_2lyli")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
@ -318,6 +372,7 @@ grow_horizontal = 0
|
|||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
text = "PR"
|
text = "PR"
|
||||||
|
label_settings = SubResource("LabelSettings_2lyli")
|
||||||
|
|
||||||
[node name="lbl_Kash" type="Label" parent="HUD/Buttons and info"]
|
[node name="lbl_Kash" type="Label" parent="HUD/Buttons and info"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
@ -334,6 +389,7 @@ grow_horizontal = 0
|
|||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
rotation = 1.5708
|
rotation = 1.5708
|
||||||
text = "KA$H"
|
text = "KA$H"
|
||||||
|
label_settings = SubResource("LabelSettings_2lyli")
|
||||||
|
|
||||||
[node name="Desc" type="Label" parent="HUD"]
|
[node name="Desc" type="Label" parent="HUD"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
@ -342,30 +398,26 @@ anchor_left = 1.0
|
|||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_left = -535.0
|
offset_left = -556.0
|
||||||
offset_top = -194.0
|
offset_top = -210.0
|
||||||
offset_right = -134.0
|
offset_right = -132.0
|
||||||
offset_bottom = -134.0
|
offset_bottom = -135.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
text = "Kash Flow: +2M$/sec. PR: +10%. Mtons: +10.
|
text = "Kash Flow: +1M$/sec. PR: +10%. Mtons: +10.
|
||||||
Cost: 6M$. Cost: 5M$. PR: -5%.
|
Cost: 6M$. Cost: 5M$. PR: -5%.
|
||||||
Cost: 30M$."
|
Cost: 30M$."
|
||||||
label_settings = SubResource("LabelSettings_adeuk")
|
label_settings = SubResource("LabelSettings_adeuk")
|
||||||
|
|
||||||
[node name="Time" type="Label" parent="HUD"]
|
[node name="Time" type="Label" parent="HUD"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 5
|
||||||
anchor_left = 1.0
|
anchor_left = 0.5
|
||||||
anchor_top = 1.0
|
anchor_right = 0.5
|
||||||
anchor_right = 1.0
|
offset_left = -37.0
|
||||||
anchor_bottom = 1.0
|
offset_right = 37.0
|
||||||
offset_left = -133.0
|
offset_bottom = 91.0
|
||||||
offset_top = -389.0
|
grow_horizontal = 2
|
||||||
offset_right = -90.0
|
|
||||||
offset_bottom = -352.0
|
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 0
|
|
||||||
text = "60"
|
text = "60"
|
||||||
label_settings = SubResource("LabelSettings_kxike")
|
label_settings = SubResource("LabelSettings_kxike")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user