Commit 6a3a5efd authored by Emery Tanghanwaye's avatar Emery Tanghanwaye
Browse files

waterGame: add backgrounds, remove features we will not complete

parent 1fdc0b66
......@@ -5,7 +5,7 @@ using System.Collections.Generic;
public class Game : Node2D
{
// initial amount of money player has
private float _Money = 0f;
private float _Money = 990f;
// the amount of money player earns per second
private float _ProfitRate = 1f;
......@@ -13,7 +13,9 @@ public class Game : Node2D
private int CurrentStage = 1;
// the threshold needed to progress to the next stage
private int NextStageRequirement = 1000;
private int NextProfitRequirement = 25;
// sprite for the game background
private AnimatedSprite Background;
// Labels for different text labels in the game
private Label MoneyLabel;
......@@ -23,7 +25,7 @@ public class Game : Node2D
private Label TargetRateLabel;
// Reference to the GUI node to add buttons and labels to
private Control GUI;
private Control ButtonHolder;
// reference to button group for UI navigation
private ButtonGroup ButtGroup;
......@@ -40,7 +42,13 @@ public class Game : Node2D
set
{
if (value < 0)
{
_Money = 0;
}
else
{
_Money = value;
}
}
}
......@@ -80,14 +88,14 @@ public class Game : Node2D
}
WButton button = new WButton(buttName, baseCost, cashPerSec, isBad);
GUI.AddChild(button);
ButtonHolder.AddChild(button);
float xPos = ButtXVals[XIndex] + (1280f * (CurrentStage - 1f));
button.SetPosition(new Vector2(xPos, ButtYVals[YIndex]));
button.SetSize(new Vector2(220f, 100f));
WLabel label = new WLabel(button);
GUI.AddChild(label);
ButtonHolder.AddChild(label);
YIndex++;
}
......@@ -191,11 +199,6 @@ public class Game : Node2D
// function for handing the move between stages
private void IncreaseStage()
{
if (ProfitRate < NextProfitRequirement)
{
EndGameRate();
}
// increments our stage number variable
CurrentStage++;
......@@ -206,10 +209,10 @@ public class Game : Node2D
// enables the next button in the button group, moves us to the next stage and changes the name
if (CurrentStage == 2)
{
Background.Frame = 1;
ButtGroup.EnableNextButton();
CreateSecondStageButtons();
NextStageRequirement = 20000;
NextProfitRequirement = 500;
StageLabel.Text = "Stage: River";
ProfitRate += 10f;
}
......@@ -220,14 +223,15 @@ public class Game : Node2D
ButtGroup.EnableNextButton();
CreateThirdStageButtons();
NextStageRequirement = 250000;
NextProfitRequirement = 7500;
ProfitRate += 200;
if (BadPoints >= 10)
{
Background.Frame = 2;
StageLabel.Text = "Stage: Ocean";
}
else
{
Background.Frame = 3;
StageLabel.Text = "Stage: Spring Water";
}
}
......@@ -238,14 +242,15 @@ public class Game : Node2D
ButtGroup.EnableNextButton();
CreateFourthStageButtons();
NextStageRequirement = 5000000;
NextProfitRequirement = 100000;
ProfitRate += 5000;
if (BadPoints >= 20)
{
Background.Frame = 5;
StageLabel.Text = "Stage: Glacier";
}
else
{
Background.Frame = 4;
StageLabel.Text = "Stage: Dam";
}
}
......@@ -259,6 +264,7 @@ public class Game : Node2D
}
else
{
Background.Frame = 5;
ButtGroup.EnableNextButton();
CreateFifthStageButtons();
StageLabel.Text = "Stage 5: Philanthropy";
......@@ -273,13 +279,11 @@ public class Game : Node2D
// TODO
}
private void EndGameRate()
{
// TODO
}
public override void _Ready()
{
// pulls in background object
Background = GetNode<AnimatedSprite>("GUI/CanvasLayer/Background");
// Pulls in our labels
MoneyLabel = GetNode<Label>("GUI/CanvasLayer/MoneyLabel");
ProfitLabel = GetNode<Label>("GUI/CanvasLayer/ProfitLabel");
......@@ -288,7 +292,7 @@ public class Game : Node2D
TargetRateLabel = GetNode<Label>("GUI/CanvasLayer/TargetRateLabel");
// Pull in GUI reference
GUI = GetNode<Control>("GUI");
ButtonHolder = GetNode<Control>("GUI/CanvasLayer/ButtonHolder");
// Get Button Group Reference
ButtGroup = GetNode<ButtonGroup>("ScrollCamera/CanvasLayer/ButtonGroup");
......@@ -308,7 +312,6 @@ public class Game : Node2D
// label text setting handling
MoneyLabel.Text = $"{Money:C2}";
ProfitLabel.Text = $"{ProfitRate:C2} per second";
TargetRateLabel.Text = $"Next Profit Goal: {NextProfitRequirement:C2} per second";
// sets the goal to something mysterious if a bad player hits the loss condition
if ((CurrentStage == 5) && (BadPoints >= 20))
......
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Game.cs" type="Script" id=1]
[ext_resource path="res://ButtonGroup.cs" type="Script" id=2]
[ext_resource path="res://assets/level1.jpeg" type="Texture" id=3]
[ext_resource path="res://assets/level2.jpeg" type="Texture" id=4]
[ext_resource path="res://assets/level3bad.jpeg" type="Texture" id=5]
[ext_resource path="res://assets/level3good.jpeg" type="Texture" id=6]
[ext_resource path="res://assets/level4bad.jpg" type="Texture" id=7]
[ext_resource path="res://assets/level4good.jpeg" type="Texture" id=8]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="Game" type="Node2D"]
script = ExtResource( 1 )
......@@ -31,6 +45,11 @@ script = ExtResource( 2 )
[node name="CanvasLayer" type="CanvasLayer" parent="GUI"]
[node name="Background" type="AnimatedSprite" parent="GUI/CanvasLayer"]
scale = Vector2( 0.6, 0.6 )
frames = SubResource( 1 )
centered = false
[node name="ProfitLabel" type="Label" parent="GUI/CanvasLayer"]
margin_left = 60.0
margin_top = 30.0
......@@ -59,9 +78,14 @@ margin_right = 60.0
margin_bottom = 89.0
text = "Next Goal: $0"
[node name="TargetRateLabel" type="Label" parent="GUI/CanvasLayer"]
margin_left = 60.0
margin_top = 90.0
margin_right = 147.0
margin_bottom = 104.0
text = "Target $/s: $0"
[node name="ColorRect" type="ColorRect" parent="GUI/CanvasLayer"]
modulate = Color( 1, 1, 1, 0.803922 )
margin_left = -91.0
margin_top = 115.0
margin_right = 1407.0
margin_bottom = 692.0
color = Color( 0.25098, 0.25098, 0.25098, 1 )
[node name="ButtonHolder" type="Control" parent="GUI/CanvasLayer"]
margin_right = 40.0
margin_bottom = 40.0
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level1.jpeg-083cf83ef21414301f194f9566bb4ce7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level1.jpeg"
dest_files=[ "res://.import/level1.jpeg-083cf83ef21414301f194f9566bb4ce7.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level2.jpeg-95a8ed45e438b4e9ea8b19f1f7342ecd.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level2.jpeg"
dest_files=[ "res://.import/level2.jpeg-95a8ed45e438b4e9ea8b19f1f7342ecd.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level3bad.jpeg-433562c83eea44c7143fc5059ab99b41.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level3bad.jpeg"
dest_files=[ "res://.import/level3bad.jpeg-433562c83eea44c7143fc5059ab99b41.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level3good.jpeg-350621a4a44b9906ad96b7cce520ee78.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level3good.jpeg"
dest_files=[ "res://.import/level3good.jpeg-350621a4a44b9906ad96b7cce520ee78.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level4bad.jpg-6029d9b4d09d32b5762ac8c855b7078d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level4bad.jpg"
dest_files=[ "res://.import/level4bad.jpg-6029d9b4d09d32b5762ac8c855b7078d.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level4good.jpeg-ff0b420b923323d28ca561cd49f4d5b3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level4good.jpeg"
dest_files=[ "res://.import/level4good.jpeg-ff0b420b923323d28ca561cd49f4d5b3.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/level5good.jpeg-33935faf3fd7731d0664119ab7af1c9d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/level5good.jpeg"
dest_files=[ "res://.import/level5good.jpeg-33935faf3fd7731d0664119ab7af1c9d.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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment