summaryrefslogtreecommitdiff
path: root/Penguloon
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-29 00:32:34 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-29 00:32:34 +0100
commit5373e919a0d9e389fc2076963f610d044c21ccb5 (patch)
treedafaf1e2f4857d37bb8ba36cd02c8ccd7d40635e /Penguloon
parenta9adf4d4d52a9d42b885e2fc1dee9ea2f4451331 (diff)
level implementation XDDDDDDDd
Diffstat (limited to 'Penguloon')
-rw-r--r--Penguloon/Content/Content.mgcb36
-rw-r--r--Penguloon/Content/SplashArt/1.pngbin29248 -> 29218 bytes
-rw-r--r--Penguloon/Content/SplashArt/2.pngbin0 -> 48032 bytes
-rw-r--r--Penguloon/Content/SplashArt/locked.pngbin0 -> 3739 bytes
-rw-r--r--Penguloon/Content/UI/lock.pngbin0 -> 3216 bytes
-rw-r--r--Penguloon/ContentPathManager.cs3
-rw-r--r--Penguloon/Controls/LevelSelector.cs55
-rw-r--r--Penguloon/Levels/IceLevel.cs1
-rw-r--r--Penguloon/Levels/IceLevel2.cs74
-rw-r--r--Penguloon/Levels/LevelBase.cs4
-rw-r--r--Penguloon/Penguloon.csproj1
-rw-r--r--Penguloon/Resources/Resource.Designer.cs29
-rw-r--r--Penguloon/Resources/Values/Strings.xml2
-rw-r--r--Penguloon/Scenes/LevelSelectionScene.cs4
-rw-r--r--Penguloon/Scenes/StatsScene.cs14
-rw-r--r--Penguloon/UserdataManager.cs16
16 files changed, 220 insertions, 19 deletions
diff --git a/Penguloon/Content/Content.mgcb b/Penguloon/Content/Content.mgcb
index b8e9f20..6deb51f 100644
--- a/Penguloon/Content/Content.mgcb
+++ b/Penguloon/Content/Content.mgcb
@@ -577,3 +577,39 @@
/processorParam:TextureFormat=Color
/build:UI/unselectableTile.png
+#begin UI/lock.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/lock.png
+
+#begin SplashArt/locked.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:SplashArt/locked.png
+
+#begin SplashArt/2.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:SplashArt/2.png
+
diff --git a/Penguloon/Content/SplashArt/1.png b/Penguloon/Content/SplashArt/1.png
index 48d4390..2d3b26c 100644
--- a/Penguloon/Content/SplashArt/1.png
+++ b/Penguloon/Content/SplashArt/1.png
Binary files differ
diff --git a/Penguloon/Content/SplashArt/2.png b/Penguloon/Content/SplashArt/2.png
new file mode 100644
index 0000000..2a25ed6
--- /dev/null
+++ b/Penguloon/Content/SplashArt/2.png
Binary files differ
diff --git a/Penguloon/Content/SplashArt/locked.png b/Penguloon/Content/SplashArt/locked.png
new file mode 100644
index 0000000..894ea2f
--- /dev/null
+++ b/Penguloon/Content/SplashArt/locked.png
Binary files differ
diff --git a/Penguloon/Content/UI/lock.png b/Penguloon/Content/UI/lock.png
new file mode 100644
index 0000000..73f1ff7
--- /dev/null
+++ b/Penguloon/Content/UI/lock.png
Binary files differ
diff --git a/Penguloon/ContentPathManager.cs b/Penguloon/ContentPathManager.cs
index 9086f24..58fafda 100644
--- a/Penguloon/ContentPathManager.cs
+++ b/Penguloon/ContentPathManager.cs
@@ -45,8 +45,11 @@ namespace Penguloon
"UI/optionsMenuBackground",
"UI/msgBoxBackground",
"UI/unselectableTile",
+ "UI/lock",
+ "SplashArt/locked",
"SplashArt/1",
+ "SplashArt/2",
"Enemies/pop",
"Enemies/red",
diff --git a/Penguloon/Controls/LevelSelector.cs b/Penguloon/Controls/LevelSelector.cs
index 4878e4c..c04aef3 100644
--- a/Penguloon/Controls/LevelSelector.cs
+++ b/Penguloon/Controls/LevelSelector.cs
@@ -23,6 +23,8 @@ namespace Penguloon.Controls
public LevelSelector(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size)
{
+ UserdataManager.Level = UserdataManager.GetLevel();
+
this.BackgroundIdle = ContentManager.GetTexture("UI/btnIdle");
this.BackgroundPressed = ContentManager.GetTexture("UI/btnIdle");
this.BackgroundDisabled = ContentManager.GetTexture("UI/btnIdle");
@@ -54,7 +56,7 @@ namespace Penguloon.Controls
selectedMap--;
}
- if (Panel2.Intersects(fingerRec))
+ if (Panel2.Intersects(fingerRec) && Levels[selectedMap].MinimumLevel <= UserdataManager.Level)
{
SoundManager.PlayClickSound();
SceneManager.GameScene = new GameScene(ParentScene.Main, Levels[selectedMap]);
@@ -70,8 +72,7 @@ namespace Penguloon.Controls
private void CreateLevels()
{
Levels.Add(new IceLevel());
- Levels.Add(new IceLevel());
- Levels.Add(new IceLevel());
+ Levels.Add(new IceLevel2());
}
public override void Draw(float deltaTime)
@@ -88,16 +89,64 @@ namespace Penguloon.Controls
{
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap - 1].SplashArt,
destinationRectangle: Panel1);
+
+ if (Levels[selectedMap - 1].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel1);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel1.X + 25, Panel1.Y + 25, 100, 100));
+
+ DrawLevel(new Vector2(Panel1.X + 25, Panel1.Y + Panel1.Height - 10), Levels[selectedMap - 1].MinimumLevel);
+ }
}
if (selectedMap + 1 < Levels.Count)
{
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap + 1].SplashArt,
destinationRectangle: Panel3);
+
+ if (Levels[selectedMap + 1].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel3);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel3.X + 25, Panel3.Y + 25, 100, 100));
+
+ DrawLevel(new Vector2(Panel3.X + 25, Panel3.Y + Panel3.Height - 10), Levels[selectedMap + 1].MinimumLevel);
+ }
}
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap].SplashArt,
destinationRectangle: Panel2);
+
+ if (Levels[selectedMap].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel2);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel2.X + 25, Panel2.Y + 25, 100, 100));
+
+ DrawLevel(new Vector2(Panel2.X + 25, Panel2.Y + Panel2.Height - 10), Levels[selectedMap].MinimumLevel);
+ }
+ }
+
+ private void DrawLevel(Vector2 position, int minLevel)
+ {
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
+ minLevel.ToString(),
+ new Vector2((int)position.X + ContentManager.GetFont(StaticUIValues.StatsFont).MeasureString(ParentScene.Main.Resources.GetString(Resource.String.StatsLevel) + " ").X, position.Y),
+ new Vector2(0, 0),
+ TextAllignment.LeftBottom, Color.White, Color.Black, 2);
+
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
+ ParentScene.Main.Resources.GetString(Resource.String.StatsLevel) + " ",
+ new Vector2((int)position.X, position.Y),
+ new Vector2(0, 0),
+ TextAllignment.LeftBottom, Color.FromNonPremultiplied(200, 200, 200, 200), Color.Black, 2);
}
}
} \ No newline at end of file
diff --git a/Penguloon/Levels/IceLevel.cs b/Penguloon/Levels/IceLevel.cs
index 237ebf8..1a810a7 100644
--- a/Penguloon/Levels/IceLevel.cs
+++ b/Penguloon/Levels/IceLevel.cs
@@ -14,6 +14,7 @@ namespace Penguloon.Levels
this.Money = 350;
this.Health = 200;
this.ID = 1;
+ this.MinimumLevel = 0;
}
public override void DrawUnique(float deltaTime)
diff --git a/Penguloon/Levels/IceLevel2.cs b/Penguloon/Levels/IceLevel2.cs
new file mode 100644
index 0000000..86e3ce3
--- /dev/null
+++ b/Penguloon/Levels/IceLevel2.cs
@@ -0,0 +1,74 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input.Touch;
+using Penguloon.Enemies;
+using Penguloon.Objects;
+using Penguloon.Scenes;
+
+namespace Penguloon.Levels
+{
+ public class IceLevel2 : LevelBase
+ {
+ public IceLevel2() : base()
+ {
+ this.SplashArt = ContentManager.GetTexture("SplashArt/2");
+ this.Money = 350;
+ this.Health = 200;
+ this.ID = 2;
+ this.MinimumLevel = 5;
+ }
+
+ public override void DrawUnique(float deltaTime)
+ {
+ base.DrawUnique(deltaTime);
+ }
+
+ public override void UpdateUnique(float deltaTime, TouchLocation[] touchLocations)
+ {
+ base.UpdateUnique(deltaTime, touchLocations);
+ }
+
+ public override void CreateMap()
+ {
+ Map = new Map(ParentScene, this);
+ Map.SpawnPoint = new Vector2(18 * Map.TileWidth, 6 * Map.TileHeight);
+ Map.SpawnPointTargetPos = new Vector2(17 * Map.TileWidth, 6 * Map.TileHeight);
+ Map.FinishPoint = new Vector2(-1 * Map.TileWidth, 9 * Map.TileHeight);
+
+ Tile OO = new Tile(0, Direction.None);
+
+ Tile DN = new Tile(6, Direction.Down);
+ Tile RT = new Tile(5, Direction.Right);
+ Tile LT = new Tile(5, Direction.Left);
+ Tile UP = new Tile(6, Direction.Up);
+
+ Tile TR = new Tile(4, Direction.Right);
+ Tile RU = new Tile(4, Direction.Up);
+ Tile DR = new Tile(3, Direction.Right);
+
+ Tile DL = new Tile(1, Direction.Down);
+ Tile RD = new Tile(3, Direction.Down);
+ Tile LD = new Tile(1, Direction.Left);
+ Tile LU = new Tile(2, Direction.Left);
+ Tile TL = new Tile(2, Direction.Up);
+
+ Tile FN = new Tile(5, Direction.Finish);
+
+ Map.TileMap = new Tile[13, 18]
+ {
+ { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO },
+ { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO },
+ { OO,OO,RD,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LD,OO,OO },
+ { OO,OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,UP,OO,OO },
+ { OO,OO,DN,OO,DR,RT,DL,OO,DR,RT,DL,OO,OO,OO,OO,UP,OO,OO },
+ { OO,OO,DN,OO,UP,OO,DN,OO,UP,OO,DN,OO,OO,OO,OO,UP,OO,OO },
+ { OO,OO,DN,OO,UP,OO,DN,OO,UP,OO,DN,OO,OO,OO,OO,RU,LT,LT },
+ { OO,OO,TR,RT,TL,OO,TR,RT,TL,OO,TR,RT,RT,DL,OO,OO,OO,OO },
+ { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,DN,OO,OO,OO,OO },
+ { FN,LD,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,DN,OO,OO,OO,OO },
+ { OO,UP,OO,RD,LT,LT,LT,LT,LT,LT,LT,LT,LT,LU,OO,OO,OO,OO },
+ { OO,RU,LT,LU,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO },
+ { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO },
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Penguloon/Levels/LevelBase.cs b/Penguloon/Levels/LevelBase.cs
index fbd6bd7..351cdcf 100644
--- a/Penguloon/Levels/LevelBase.cs
+++ b/Penguloon/Levels/LevelBase.cs
@@ -25,6 +25,8 @@ namespace Penguloon.Levels
public bool Finished { get; set; } = false;
+ public int MinimumLevel { get; set; }
+
public LevelBase()
{
@@ -117,6 +119,8 @@ namespace Penguloon.Levels
UserdataManager.HighestRound = Map.WaveManager.CurrentWave - 1;
UserdataManager.WriteData(ParentScene.Main.Context);
+
+ UserdataManager.Level = UserdataManager.GetLevel();
}
}
} \ No newline at end of file
diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj
index a7d05f1..2f84d4b 100644
--- a/Penguloon/Penguloon.csproj
+++ b/Penguloon/Penguloon.csproj
@@ -80,6 +80,7 @@
<Compile Include="Enemies\RainbowBalloon.cs" />
<Compile Include="Enemies\RedBalloon.cs" />
<Compile Include="Enemies\YellowBalloon.cs" />
+ <Compile Include="Levels\IceLevel2.cs" />
<Compile Include="Levels\WaveManager.cs" />
<Compile Include="Objects\CannonObject.cs" />
<Compile Include="Objects\GoldPenguinObject.cs" />
diff --git a/Penguloon/Resources/Resource.Designer.cs b/Penguloon/Resources/Resource.Designer.cs
index 196b7e9..34550cd 100644
--- a/Penguloon/Resources/Resource.Designer.cs
+++ b/Penguloon/Resources/Resource.Designer.cs
@@ -96,26 +96,29 @@ namespace Penguloon
// aapt resource value: 0x7f030002
public const int MenuBtnStats = 2130903042;
- // aapt resource value: 0x7f030010
- public const int StatsBestKills = 2130903056;
-
// aapt resource value: 0x7f030011
- public const int StatsBestRound = 2130903057;
+ public const int StatsBestKills = 2130903057;
- // aapt resource value: 0x7f03000f
- public const int StatsBestStatsTitle = 2130903055;
+ // aapt resource value: 0x7f030012
+ public const int StatsBestRound = 2130903058;
- // aapt resource value: 0x7f03000d
- public const int StatsTotalGames = 2130903053;
+ // aapt resource value: 0x7f030010
+ public const int StatsBestStatsTitle = 2130903056;
- // aapt resource value: 0x7f03000c
- public const int StatsTotalKills = 2130903052;
+ // aapt resource value: 0x7f03000b
+ public const int StatsLevel = 2130903051;
// aapt resource value: 0x7f03000e
- public const int StatsTotalMoneySpent = 2130903054;
+ public const int StatsTotalGames = 2130903054;
- // aapt resource value: 0x7f03000b
- public const int StatsTotalStatsTitle = 2130903051;
+ // aapt resource value: 0x7f03000d
+ public const int StatsTotalKills = 2130903053;
+
+ // aapt resource value: 0x7f03000f
+ public const int StatsTotalMoneySpent = 2130903055;
+
+ // aapt resource value: 0x7f03000c
+ public const int StatsTotalStatsTitle = 2130903052;
static String()
{
diff --git a/Penguloon/Resources/Values/Strings.xml b/Penguloon/Resources/Values/Strings.xml
index 638a5bb..feffcb2 100644
--- a/Penguloon/Resources/Values/Strings.xml
+++ b/Penguloon/Resources/Values/Strings.xml
@@ -22,6 +22,8 @@
<string name="IngameNo">No</string>
<!-- stats -->
+ <string name="StatsLevel">level</string>
+
<string name="StatsTotalStatsTitle">Career total</string>
<string name="StatsTotalKills">Kills</string>
<string name="StatsTotalGames">Games</string>
diff --git a/Penguloon/Scenes/LevelSelectionScene.cs b/Penguloon/Scenes/LevelSelectionScene.cs
index 68f71ca..2bb5ae1 100644
--- a/Penguloon/Scenes/LevelSelectionScene.cs
+++ b/Penguloon/Scenes/LevelSelectionScene.cs
@@ -17,7 +17,7 @@ namespace Penguloon.Scenes
new Vector2(50, 50),
StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.LevelSelectionBack));
- btnBack.OnClick += BtnStart_OnClick;
+ btnBack.OnClick += BtnBack_OnClick;
int levelSelectorPosY = (int)((StaticUIValues.ScreenViewport.Y - StaticUIValues.MenuButtonSize.Y) - StaticUIValues.LevelSelectorHeight);
@@ -28,7 +28,7 @@ namespace Penguloon.Scenes
Controls.Add(btnBack);
}
- private void BtnStart_OnClick(object sender, ClickArgs e)
+ private void BtnBack_OnClick(object sender, ClickArgs e)
{
SceneManager.SelectedScene = SelectedScene.Menu;
}
diff --git a/Penguloon/Scenes/StatsScene.cs b/Penguloon/Scenes/StatsScene.cs
index aa5dd29..948e77f 100644
--- a/Penguloon/Scenes/StatsScene.cs
+++ b/Penguloon/Scenes/StatsScene.cs
@@ -9,7 +9,7 @@ namespace Penguloon.Scenes
{
public StatsScene(Main main) : base(main)
{
-
+ UserdataManager.Level = UserdataManager.GetLevel();
}
public override void CreateControls()
@@ -68,6 +68,18 @@ namespace Penguloon.Scenes
int martinXRight = StaticUIValues.StatsMarginXRight;
+ DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
+ UserdataManager.Level.ToString(),
+ new Vector2((int)StaticUIValues.ScreenViewport.X - martinXRight, 75),
+ new Vector2(0, 0),
+ TextAllignment.RightTop, Color.White, Color.Black, 2);
+
+ DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
+ Main.Resources.GetString(Resource.String.StatsLevel) + " ",
+ new Vector2((int)StaticUIValues.ScreenViewport.X - martinXRight - ContentManager.GetFont(StaticUIValues.StatsFont).MeasureString(UserdataManager.Level.ToString()).X, 75),
+ new Vector2(0, 0),
+ TextAllignment.RightTop, Color.FromNonPremultiplied(200, 200, 200, 200), Color.Black, 2);
+
// Total kills
DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
Main.Resources.GetString(Resource.String.StatsTotalKills),
diff --git a/Penguloon/UserdataManager.cs b/Penguloon/UserdataManager.cs
index 872ab1d..eca3580 100644
--- a/Penguloon/UserdataManager.cs
+++ b/Penguloon/UserdataManager.cs
@@ -15,6 +15,8 @@ namespace Penguloon
public static int HighestRound { get; set; }
public static int HighestKills { get; set; }
+ public static int Level { get; set; }
+
public static void WriteData(Context context)
{
File file = new File(context.CacheDir, "userdata.txt");
@@ -46,5 +48,19 @@ namespace Penguloon
HighestKills = int.Parse(lines[4]);
}
}
+
+ public static int GetLevel()
+ {
+ for (int i = 0; i < 999; i++)
+ {
+ int killsNeeded = (int)((i * 50) * (i * 1.1));
+
+ if (TotalKills > killsNeeded) continue;
+
+ return i;
+ }
+
+ return 0;
+ }
}
} \ No newline at end of file