diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-13 00:18:04 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-13 00:18:04 +0100 |
| commit | 4ae069581351b8712fd4647e9b902da1e3c9dbe3 (patch) | |
| tree | 044e6a02a8836b725cf630feb597ef7d413cc951 /Penguloon | |
| parent | f93e133ede2a76be1aa20a33c9fcf01308cd6df8 (diff) | |
yikes
Diffstat (limited to 'Penguloon')
| -rw-r--r-- | Penguloon/Content/Content.mgcb | 12 | ||||
| -rw-r--r-- | Penguloon/Content/Objects/penguin3.png | bin | 0 -> 22402 bytes | |||
| -rw-r--r-- | Penguloon/ContentPathManager.cs | 1 | ||||
| -rw-r--r-- | Penguloon/Controls/ObjectSelector.cs | 21 | ||||
| -rw-r--r-- | Penguloon/Levels/LevelBase.cs | 76 | ||||
| -rw-r--r-- | Penguloon/Levels/Map.cs | 5 | ||||
| -rw-r--r-- | Penguloon/Objects/KingPenguinObject.cs | 45 | ||||
| -rw-r--r-- | Penguloon/Objects/MortarObject.cs | 4 | ||||
| -rw-r--r-- | Penguloon/Objects/ObjectBase.cs | 5 | ||||
| -rw-r--r-- | Penguloon/Penguloon.csproj | 1 | ||||
| -rw-r--r-- | Penguloon/Resources/Resource.Designer.cs | 62 | ||||
| -rw-r--r-- | Penguloon/Resources/Values/Strings.xml | 4 |
12 files changed, 192 insertions, 44 deletions
diff --git a/Penguloon/Content/Content.mgcb b/Penguloon/Content/Content.mgcb index df948a6..7705248 100644 --- a/Penguloon/Content/Content.mgcb +++ b/Penguloon/Content/Content.mgcb @@ -799,3 +799,15 @@ /processorParam:Quality=Best /build:Sounds/click3.wav +#begin Objects/penguin3.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:Objects/penguin3.png + diff --git a/Penguloon/Content/Objects/penguin3.png b/Penguloon/Content/Objects/penguin3.png Binary files differnew file mode 100644 index 0000000..8649ac8 --- /dev/null +++ b/Penguloon/Content/Objects/penguin3.png diff --git a/Penguloon/ContentPathManager.cs b/Penguloon/ContentPathManager.cs index 78da37f..1831972 100644 --- a/Penguloon/ContentPathManager.cs +++ b/Penguloon/ContentPathManager.cs @@ -22,6 +22,7 @@ namespace Penguloon "Objects/cannon", "Objects/penguin1", "Objects/penguin2", + "Objects/penguin3", "Objects/healthRegenerator", "Objects/mortar", "Objects/mortarBase", diff --git a/Penguloon/Controls/ObjectSelector.cs b/Penguloon/Controls/ObjectSelector.cs index 8a48be4..fd444c8 100644 --- a/Penguloon/Controls/ObjectSelector.cs +++ b/Penguloon/Controls/ObjectSelector.cs @@ -129,7 +129,8 @@ namespace Penguloon.Controls Objects.Add(new Tuple<ObjectBase, int>(new GoldPenguinObject(Map), 360)); Objects.Add(new Tuple<ObjectBase, int>(new CannonObject(Map), 650)); Objects.Add(new Tuple<ObjectBase, int>(new HealthGeneratorObject(Map), 800)); - Objects.Add(new Tuple<ObjectBase, int>(new MortarObject(Map), 150)); + Objects.Add(new Tuple<ObjectBase, int>(new MortarObject(Map), 1200)); + Objects.Add(new Tuple<ObjectBase, int>(new KingPenguinObject(Map), 2550)); } public override void Update(float deltaTime, TouchLocation[] touchLocations) @@ -172,11 +173,16 @@ namespace Penguloon.Controls //int widthToDraw = (height / Objects[i].Item1.TileSpanY) - (padding * (3 - Objects[i].Item1.TileSpanY)); //int heightToDraw = (height / Objects[i].Item1.TileSpanX) - (padding * (3 - Objects[i].Item1.TileSpanX)); - int spanY = 1; - int spanX = 1; + float spanY = 1; + float spanX = 1; - int widthToDraw = (width / spanY) - (padding * 2); - int heightToDraw = (height / spanX) - (padding * 2); + if (Objects[i].Item1.TileSpanX < Objects[i].Item1.TileSpanY) + spanY = 1.3f; + else if (Objects[i].Item1.TileSpanX > Objects[i].Item1.TileSpanY) + spanX = 1.3f; + + int widthToDraw = (int)(height / spanY) - (padding * 2); + int heightToDraw = (int)(height / spanX) - (padding * 2); if (Objects[i].Item1.TextureBase != null) ParentScene.Main.SpriteBatch.Draw(Objects[i].Item1.TextureBase, @@ -185,8 +191,13 @@ namespace Penguloon.Controls ParentScene.Main.SpriteBatch.Draw(Objects[i].Item1.Texture, destinationRectangle: new Rectangle(posX + (width - widthToDraw) / 2, (int)Position.Y + posY + (height / 2) - (heightToDraw / 2), widthToDraw, heightToDraw)); + // object cost ParentScene.DrawText(ContentManager.GetFont("Fonts/GWENT/36"), Objects[i].Item2.ToString(), new Vector2(posX, (int)Position.Y + posY), new Vector2(width, height), TextAllignment.CenterBottom, Color.White, Color.Black, 2); + + //object size + ParentScene.DrawText(ContentManager.GetFont("Fonts/GWENT/16"), Objects[i].Item1.TileSpanX.ToString() + "x" + Objects[i].Item1.TileSpanY.ToString(), new Vector2(posX + 5, (int)Position.Y + posY + 5), + new Vector2(width, height), TextAllignment.LeftTop, Color.White, Color.Black, 2); } // Draw borders diff --git a/Penguloon/Levels/LevelBase.cs b/Penguloon/Levels/LevelBase.cs index eb34dae..31f94fa 100644 --- a/Penguloon/Levels/LevelBase.cs +++ b/Penguloon/Levels/LevelBase.cs @@ -5,6 +5,8 @@ using Microsoft.Xna.Framework.Input.Touch; using Penguloon.Scenes; using Penguloon.Controls; using System.Collections.Generic; +using Penguloon.Objects; +using Microsoft.Xna.Framework.Input; namespace Penguloon.Levels { @@ -32,6 +34,10 @@ namespace Penguloon.Levels public int MinimumLevel { get; set; } + public TouchLocation[] PrevTouchLocations { get; set; } + + public DateTime StartDate { get; set; } + public LevelBase() { @@ -41,6 +47,7 @@ namespace Penguloon.Levels public virtual void Initialize(GameScene sceneBase) { + StartDate = DateTime.Now; this.ParentScene = sceneBase; CreateMap(); @@ -52,6 +59,51 @@ namespace Penguloon.Levels Map.Draw(deltaTime); DrawUnique(deltaTime); + + DrawSelectedObject(); + + string time = (DateTime.Now - StartDate).ToString("hh':'mm':'ss"); + + ParentScene.DrawText(ContentManager.GetFont("Fonts/GWENT/36"), time, new Vector2(10, StaticUIValues.ScreenViewport.Y - ContentManager.GetFont("Fonts/GWENT/36").MeasureString("XD").Y - 10), + new Vector2(), TextAllignment.LeftTop, Color.White, Color.Black, 2); + } + + private void DrawSelectedObject() + { + if (ParentScene.ObjectSeletor.State == Controls.State.Idle || ParentScene.ObjectSeletor.SelectedObjectIndex == -1) return; + + for (int i = 0; i < PrevTouchLocations.Length; i++) + { + if (PrevTouchLocations[i].State != TouchLocationState.Moved && PrevTouchLocations[i].State != TouchLocationState.Pressed) continue; + + ObjectBase obj = ParentScene.ObjectSeletor.Objects[ParentScene.ObjectSeletor.SelectedObjectIndex].Item1; + + Point tilePos = PrevTouchLocations[i].Position.ToPoint(); + tilePos.X = (tilePos.X / Map.TileWidth) * Map.TileWidth; + tilePos.Y = (tilePos.Y / Map.TileHeight) * Map.TileHeight; + + int objWidth = Map.TileWidth * obj.TileSpanX; + int objHeight = Map.TileHeight * obj.TileSpanY; + + int rangeWidth = (int)(obj.Range * 2); + int rangeHeight = (int)(obj.Range * 2); + + Rectangle rangeCircleRec = new Rectangle(tilePos.X - ((rangeWidth - objWidth) / 2), tilePos.Y - ((rangeHeight - objHeight) / 2), rangeWidth, rangeHeight); + + if (obj.RangeCircle == null) + obj.RangeCircle = obj.CreateCircle((int)obj.Range * 2); + + if (obj.RangeCircle != null) + Map.ParentScene.Main.SpriteBatch.Draw(obj.RangeCircle, + destinationRectangle: rangeCircleRec); + + if (obj.TextureBase != null) + ParentScene.Main.SpriteBatch.Draw(obj.TextureBase, + destinationRectangle: new Rectangle(tilePos, new Point(objWidth, objHeight))); + + ParentScene.Main.SpriteBatch.Draw(obj.Texture, + destinationRectangle: new Rectangle(tilePos, new Point(objWidth, objHeight))); + } } public void Update(float deltaTime, TouchLocation[] touchLocations) @@ -67,6 +119,8 @@ namespace Penguloon.Levels CheckForObjectPlacement(touchLocations); CheckForLevelUp(); + + PrevTouchLocations = touchLocations; } int lastLevelCheck; @@ -98,7 +152,12 @@ namespace Penguloon.Levels int tileX = (int)touchLocations[i].Position.X / Map.TileWidth; int tileY = (int)touchLocations[i].Position.Y / Map.TileHeight; - if (Map.TileMap[tileY, tileX].Direction != Direction.None) return; + if (Map.TileMap[tileY, tileX].Direction != Direction.None) + { + ParentScene.ObjectSeletor.State = Controls.State.Idle; + ParentScene.ObjectSeletor.SelectedObjectIndex = -1; + return; + } int posToSpawnX = tileX * Map.TileWidth; int posToSpawnY = tileY * Map.TileHeight; @@ -122,8 +181,12 @@ namespace Penguloon.Levels Vector2 posToCheck = Map.Objects[x].Position + new Vector2(px * Map.TileWidth, py * Map.TileHeight); for (int t = 0; t < spawnPosToCheck.Count; t++) - if (posToCheck == spawnPosToCheck[t]) - return; + if (posToCheck == spawnPosToCheck[t]) + { + ParentScene.ObjectSeletor.State = Controls.State.Idle; + ParentScene.ObjectSeletor.SelectedObjectIndex = -1; + return; + } } } } @@ -140,7 +203,12 @@ namespace Penguloon.Levels try { - if (Map.TileMap[ty, tx].Direction != Direction.None) return; + if (Map.TileMap[ty, tx].Direction != Direction.None) + { + ParentScene.ObjectSeletor.State = Controls.State.Idle; + ParentScene.ObjectSeletor.SelectedObjectIndex = -1; + return; + } } catch { return; } } diff --git a/Penguloon/Levels/Map.cs b/Penguloon/Levels/Map.cs index 806c8de..c4dadaf 100644 --- a/Penguloon/Levels/Map.cs +++ b/Penguloon/Levels/Map.cs @@ -264,6 +264,11 @@ namespace Penguloon.Levels var b = new MortarObject(pos, this); Objects.Add(b); } + if (type == typeof(KingPenguinObject)) + { + var b = new KingPenguinObject(pos, this); + Objects.Add(b); + } } } diff --git a/Penguloon/Objects/KingPenguinObject.cs b/Penguloon/Objects/KingPenguinObject.cs new file mode 100644 index 0000000..721497b --- /dev/null +++ b/Penguloon/Objects/KingPenguinObject.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Penguloon.Levels; +using Penguloon.Projectiles; +using System.Collections.Generic; + +namespace Penguloon.Objects +{ + public class KingPenguinObject : ObjectBase + { + public KingPenguinObject(Vector2 position, Map map) : base(position, map) + { + this.Texture = ContentManager.GetTexture("Objects/penguin3"); + this.TileSpanX = 2; + this.TileSpanY = 2; + this.Range = Map.TileWidth * 3.5f; + this.AttackSpeedMS = 100; + this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectKingPenguin); + } + + public KingPenguinObject(Map map) : base(map) + { + this.Texture = ContentManager.GetTexture("Objects/penguin3"); + this.TileSpanX = 2; + this.TileSpanY = 2; + this.Range = Map.TileWidth * 3.5f; + this.AttackSpeedMS = 100; + this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectKingPenguin); + } + + public override void DrawUnique(float deltaTime) + { + + } + + public override void UpdateUnique(float deltaTime) + { + + } + + public override void SpawnUnique() + { + Projectiles.Add(new SnowballProjectile(this, this.Rotation)); + } + } +}
\ No newline at end of file diff --git a/Penguloon/Objects/MortarObject.cs b/Penguloon/Objects/MortarObject.cs index a2687d5..c210044 100644 --- a/Penguloon/Objects/MortarObject.cs +++ b/Penguloon/Objects/MortarObject.cs @@ -15,7 +15,7 @@ namespace Penguloon.Objects this.TileSpanY = 2; this.Range = Map.TileWidth * 7f; this.AttackSpeedMS = 4500; - this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectCannon); + this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectMortar); } public MortarObject(Map map) : base(map) @@ -26,7 +26,7 @@ namespace Penguloon.Objects this.TileSpanY = 2; this.Range = Map.TileWidth * 7f; this.AttackSpeedMS = 4500; - this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectCannon); + this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectMortar); } public override void DrawUnique(float deltaTime) diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs index c5b17be..6474afe 100644 --- a/Penguloon/Objects/ObjectBase.cs +++ b/Penguloon/Objects/ObjectBase.cs @@ -162,14 +162,11 @@ namespace Penguloon.Objects destinationRectangle: rec, rotation: (float)rot, origin: new Vector2(Texture.Width / 2, Texture.Height / 2)); - - //Map.ParentScene.Main.SpriteBatch.Draw(RangeCircle, - // destinationRectangle: new Rectangle((int)rec.X - ((int)Range), (int)rec.Y - ((int)Range), (int)Range * 2, (int)Range * 2)); } public abstract void DrawUnique(float deltaTime); - private Texture2D CreateCircle(int radius) + public Texture2D CreateCircle(int radius) { Texture2D texture = new Texture2D(Map.ParentScene.Main.GraphicsDevice, radius, radius); Color[] colorData = new Color[radius * radius]; diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj index 3021ee7..5721bb6 100644 --- a/Penguloon/Penguloon.csproj +++ b/Penguloon/Penguloon.csproj @@ -85,6 +85,7 @@ <Compile Include="Levels\IceLevel3.cs" /> <Compile Include="Levels\IceLevel2.cs" /> <Compile Include="Levels\WaveManager.cs" /> + <Compile Include="Objects\KingPenguinObject.cs" /> <Compile Include="Objects\MortarObject.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 fc3d585..37ce646 100644 --- a/Penguloon/Resources/Resource.Designer.cs +++ b/Penguloon/Resources/Resource.Designer.cs @@ -66,26 +66,26 @@ namespace Penguloon // aapt resource value: 0x7f030000 public const int ApplicationName = 2130903040; - // aapt resource value: 0x7f030010 - public const int IngameNo = 2130903056; + // aapt resource value: 0x7f030012 + public const int IngameNo = 2130903058; // aapt resource value: 0x7f030006 public const int IngameOptions = 2130903046; - // aapt resource value: 0x7f03000c - public const int IngameOptionsContinue = 2130903052; + // aapt resource value: 0x7f03000e + public const int IngameOptionsContinue = 2130903054; - // aapt resource value: 0x7f03000d - public const int IngameOptionsQuit = 2130903053; + // aapt resource value: 0x7f03000f + public const int IngameOptionsQuit = 2130903055; - // aapt resource value: 0x7f03000e - public const int IngameOptionsQuitConfirmation = 2130903054; + // aapt resource value: 0x7f030010 + public const int IngameOptionsQuitConfirmation = 2130903056; // aapt resource value: 0x7f030007 public const int IngameStart = 2130903047; - // aapt resource value: 0x7f03000f - public const int IngameYes = 2130903055; + // aapt resource value: 0x7f030011 + public const int IngameYes = 2130903057; // aapt resource value: 0x7f030005 public const int LevelSelectionBack = 2130903045; @@ -111,38 +111,44 @@ namespace Penguloon // aapt resource value: 0x7f03000b public const int ObjectHospital = 2130903051; + // aapt resource value: 0x7f03000d + public const int ObjectKingPenguin = 2130903053; + + // aapt resource value: 0x7f03000c + public const int ObjectMortar = 2130903052; + // aapt resource value: 0x7f030008 public const int ObjectPenguin = 2130903048; - // aapt resource value: 0x7f030019 - public const int StatsBestKills = 2130903065; + // aapt resource value: 0x7f03001b + public const int StatsBestKills = 2130903067; + + // aapt resource value: 0x7f03001c + public const int StatsBestRound = 2130903068; // aapt resource value: 0x7f03001a - public const int StatsBestRound = 2130903066; + public const int StatsBestStatsTitle = 2130903066; + + // aapt resource value: 0x7f030013 + public const int StatsLevel = 2130903059; // aapt resource value: 0x7f030018 - public const int StatsBestStatsTitle = 2130903064; + public const int StatsTotalGames = 2130903064; - // aapt resource value: 0x7f030011 - public const int StatsLevel = 2130903057; + // aapt resource value: 0x7f030017 + public const int StatsTotalKills = 2130903063; + + // aapt resource value: 0x7f030019 + public const int StatsTotalMoneySpent = 2130903065; // aapt resource value: 0x7f030016 - public const int StatsTotalGames = 2130903062; + public const int StatsTotalStatsTitle = 2130903062; // aapt resource value: 0x7f030015 - public const int StatsTotalKills = 2130903061; - - // aapt resource value: 0x7f030017 - public const int StatsTotalMoneySpent = 2130903063; + public const int SupportDonate = 2130903061; // aapt resource value: 0x7f030014 - public const int StatsTotalStatsTitle = 2130903060; - - // aapt resource value: 0x7f030013 - public const int SupportDonate = 2130903059; - - // aapt resource value: 0x7f030012 - public const int SupportRate = 2130903058; + public const int SupportRate = 2130903060; static String() { diff --git a/Penguloon/Resources/Values/Strings.xml b/Penguloon/Resources/Values/Strings.xml index b62b209..46cdc4c 100644 --- a/Penguloon/Resources/Values/Strings.xml +++ b/Penguloon/Resources/Values/Strings.xml @@ -17,9 +17,11 @@ <!-- objects info text --> <string name="ObjectPenguin">This penguin does not like \n balloons</string> - <string name="ObjectGoldPenguin">This penguin king shoots \n even faster than regular \n penguins</string> + <string name="ObjectGoldPenguin">This gold penguin shoots \n even faster than regular \n penguins</string> <string name="ObjectCannon">This penguin manufactored \n cannon can pop multiple \n balloons at once!</string> <string name="ObjectHospital">This weird object restores \n health after every round..</string> + <string name="ObjectMortar">This penguin mortar is \n huge and can pop alot of \n balloons at once!</string> + <string name="ObjectKingPenguin">This penguin king shoots \n at an alarmingly fast \n rate..</string> <!-- ingame options menu --> <string name="IngameOptionsContinue">Continue</string> |
