diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-02 23:36:55 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-02 23:36:55 +0100 |
| commit | a05ae287aa87259817e6ca7627986e14eeab6098 (patch) | |
| tree | 18578b24ab1c35aec05c465fbdc0af517b716fed /Penguloon | |
| parent | 0c58f5048e37ad40c68f56f3dc7756d60816cc0e (diff) | |
dank
Diffstat (limited to 'Penguloon')
| -rw-r--r-- | Penguloon/Content/Content.mgcb | 24 | ||||
| -rw-r--r-- | Penguloon/Content/Objects/mortar.png | bin | 0 -> 6894 bytes | |||
| -rw-r--r-- | Penguloon/Content/Objects/mortarBase.png | bin | 0 -> 5160 bytes | |||
| -rw-r--r-- | Penguloon/Content/UI/background.png | bin | 915 -> 915 bytes | |||
| -rw-r--r-- | Penguloon/ContentPathManager.cs | 2 | ||||
| -rw-r--r-- | Penguloon/Controls/ObjectSelector.cs | 17 | ||||
| -rw-r--r-- | Penguloon/Levels/IceLevel3.cs | 2 | ||||
| -rw-r--r-- | Penguloon/Levels/Map.cs | 53 | ||||
| -rw-r--r-- | Penguloon/Objects/MortarObject.cs | 47 | ||||
| -rw-r--r-- | Penguloon/Objects/ObjectBase.cs | 7 | ||||
| -rw-r--r-- | Penguloon/Penguloon.csproj | 1 |
11 files changed, 137 insertions, 16 deletions
diff --git a/Penguloon/Content/Content.mgcb b/Penguloon/Content/Content.mgcb index b7d585f..f3ab71e 100644 --- a/Penguloon/Content/Content.mgcb +++ b/Penguloon/Content/Content.mgcb @@ -763,3 +763,27 @@ /processorParam:TextureFormat=Color /build:SplashArt/4.png +#begin Objects/mortar.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/mortar.png + +#begin Objects/mortarBase.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/mortarBase.png + diff --git a/Penguloon/Content/Objects/mortar.png b/Penguloon/Content/Objects/mortar.png Binary files differnew file mode 100644 index 0000000..db27b4b --- /dev/null +++ b/Penguloon/Content/Objects/mortar.png diff --git a/Penguloon/Content/Objects/mortarBase.png b/Penguloon/Content/Objects/mortarBase.png Binary files differnew file mode 100644 index 0000000..1dde5f7 --- /dev/null +++ b/Penguloon/Content/Objects/mortarBase.png diff --git a/Penguloon/Content/UI/background.png b/Penguloon/Content/UI/background.png Binary files differindex 2e76011..84bf0c5 100644 --- a/Penguloon/Content/UI/background.png +++ b/Penguloon/Content/UI/background.png diff --git a/Penguloon/ContentPathManager.cs b/Penguloon/ContentPathManager.cs index 22f93a9..9a29509 100644 --- a/Penguloon/ContentPathManager.cs +++ b/Penguloon/ContentPathManager.cs @@ -23,6 +23,8 @@ namespace Penguloon "Objects/penguin1", "Objects/penguin2", "Objects/healthRegenerator", + "Objects/mortar", + "Objects/mortarBase", "Tiles/ice", "Tiles/waterCornerLeftDown", diff --git a/Penguloon/Controls/ObjectSelector.cs b/Penguloon/Controls/ObjectSelector.cs index a13f3eb..56dff8a 100644 --- a/Penguloon/Controls/ObjectSelector.cs +++ b/Penguloon/Controls/ObjectSelector.cs @@ -126,7 +126,8 @@ namespace Penguloon.Controls Objects.Add(new Tuple<ObjectBase,int>(new PenguinObject(Map), 250)); 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), 150)); + Objects.Add(new Tuple<ObjectBase, int>(new HealthGeneratorObject(Map), 800)); + Objects.Add(new Tuple<ObjectBase, int>(new MortarObject(Map), 150)); } public override void Update(float deltaTime, TouchLocation[] touchLocations) @@ -166,8 +167,18 @@ namespace Penguloon.Controls destinationRectangle: new Rectangle(posX, (int)Position.Y + posY, width, height)); } - int widthToDraw = (height / Objects[i].Item1.TileSpanY) - (padding * 2); - int heightToDraw = (height / Objects[i].Item1.TileSpanX) - (padding * (3 - Objects[i].Item1.TileSpanX)); + //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; + + int widthToDraw = (width / spanY) - (padding * 2); + int heightToDraw = (height / spanX) - (padding * 2); + + if (Objects[i].Item1.TextureBase != null) + ParentScene.Main.SpriteBatch.Draw(Objects[i].Item1.TextureBase, + destinationRectangle: new Rectangle(posX + (width - widthToDraw) / 2, (int)Position.Y + posY + (height / 2) - (heightToDraw / 2), widthToDraw, heightToDraw)); 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)); diff --git a/Penguloon/Levels/IceLevel3.cs b/Penguloon/Levels/IceLevel3.cs index e70ea70..f7a46e4 100644 --- a/Penguloon/Levels/IceLevel3.cs +++ b/Penguloon/Levels/IceLevel3.cs @@ -14,7 +14,7 @@ namespace Penguloon.Levels this.Money = 123550; this.Health = 200; this.ID = 3; - this.MinimumLevel = 5; + this.MinimumLevel = 10; LevelType = LevelType.Ice; } diff --git a/Penguloon/Levels/Map.cs b/Penguloon/Levels/Map.cs index 03e1c4f..806c8de 100644 --- a/Penguloon/Levels/Map.cs +++ b/Penguloon/Levels/Map.cs @@ -65,6 +65,25 @@ namespace Penguloon.Levels public void Draw(float deltaTime) { + DrawMap(); + + DrawSpareTiles(); + + for (int i = 0; i < Enemies.Count; i++) + { + if (Enemies[i].Texture != null) + ParentScene.Main.SpriteBatch.Draw(Enemies[i].Texture, + destinationRectangle: Enemies[i].Box); + } + + for (int i = 0; i < Objects.Count; i++) + { + Objects[i].Draw(deltaTime); + } + } + + private void DrawMap() + { for (int y = 0; y < TileMap.GetLength(0); y++) { for (int x = 0; x < TileMap.GetLength(1); x++) @@ -77,16 +96,19 @@ namespace Penguloon.Levels case LevelType.Sand: tileTexture = ContentManager.GetSandTileTextureByType(TileMap[y, x].Type); break; } - if(tileTexture != null) - ParentScene.Main.SpriteBatch.Draw(tileTexture, - destinationRectangle: new Rectangle(x * TileWidth, y * TileHeight, TileWidth, TileHeight)); + if (tileTexture != null) + ParentScene.Main.SpriteBatch.Draw(tileTexture, + destinationRectangle: new Rectangle(x * TileWidth, y * TileHeight, TileWidth, TileHeight)); //if (ParentScene.ObjectSeletor.State == Controls.State.Selected) // ParentScene.Main.SpriteBatch.Draw(tileTexture, // destinationRectangle: new Rectangle(x * TileWidth, y * TileHeight, TileWidth, TileHeight)); } } + } + private void DrawSpareTiles() + { Texture2D tileTextureSpare = null; Texture2D unplaceableTileTexture = null; @@ -113,17 +135,19 @@ namespace Penguloon.Levels } } - - for (int i = 0; i < Enemies.Count; i++) - { - if (Enemies[i].Texture != null) - ParentScene.Main.SpriteBatch.Draw(Enemies[i].Texture, - destinationRectangle: Enemies[i].Box); - } - for (int i = 0; i < Objects.Count; i++) { - Objects[i].Draw(deltaTime); + if (ParentScene.ObjectSeletor.State != Controls.State.Selected) continue; + + for (int x = 0; x < Objects[i].TileSpanX; x++) + { + for (int y = 0; y < Objects[i].TileSpanY; y++) + { + ParentScene.Main.SpriteBatch.Draw(unplaceableTileTexture, + destinationRectangle: new Rectangle((int)Objects[i].Position.X + (x * TileWidth), + (int)Objects[i].Position.Y + (y * TileHeight), TileWidth, TileHeight)); + } + } } } @@ -235,6 +259,11 @@ namespace Penguloon.Levels var b = new HealthGeneratorObject(pos, this); Objects.Add(b); } + if (type == typeof(MortarObject)) + { + var b = new MortarObject(pos, this); + Objects.Add(b); + } } } diff --git a/Penguloon/Objects/MortarObject.cs b/Penguloon/Objects/MortarObject.cs new file mode 100644 index 0000000..a2687d5 --- /dev/null +++ b/Penguloon/Objects/MortarObject.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Penguloon.Levels; +using Penguloon.Projectiles; +using System.Collections.Generic; + +namespace Penguloon.Objects +{ + class MortarObject : ObjectBase + { + public MortarObject(Vector2 position, Map map) : base(position, map) + { + this.Texture = ContentManager.GetTexture("Objects/mortar"); + this.TextureBase = ContentManager.GetTexture("Objects/mortarBase"); + this.TileSpanX = 2; + this.TileSpanY = 2; + this.Range = Map.TileWidth * 7f; + this.AttackSpeedMS = 4500; + this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectCannon); + } + + public MortarObject(Map map) : base(map) + { + this.Texture = ContentManager.GetTexture("Objects/mortar"); + this.TextureBase = ContentManager.GetTexture("Objects/mortarBase"); + this.TileSpanX = 2; + this.TileSpanY = 2; + this.Range = Map.TileWidth * 7f; + this.AttackSpeedMS = 4500; + this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectCannon); + } + + public override void DrawUnique(float deltaTime) + { + + } + + public override void UpdateUnique(float deltaTime) + { + + } + + public override void SpawnUnique() + { + Projectiles.Add(new CannonballProjectile(this, this.Rotation)); + } + } +}
\ No newline at end of file diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs index 9d00702..5bfdcb9 100644 --- a/Penguloon/Objects/ObjectBase.cs +++ b/Penguloon/Objects/ObjectBase.cs @@ -16,6 +16,7 @@ namespace Penguloon.Objects public float Range { get; set; } public Texture2D Texture { get; set; } + public Texture2D TextureBase { get; set; } public Texture2D RangeCircle { get; set; } public float Rotation { get; set; } = -0f; @@ -144,6 +145,12 @@ namespace Penguloon.Objects Map.TileWidth * TileSpanX, Map.TileHeight * TileSpanY); + // Draw object base + if (TextureBase != null) + Map.ParentScene.Main.SpriteBatch.Draw(TextureBase, + destinationRectangle: rec, + origin: new Vector2(Texture.Width / 2, Texture.Height / 2)); + // Draw projectiles before drawing the object for (int i = 0; i < Projectiles.Count; i++) Projectiles[i].Draw(deltaTime); diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj index 95ec810..3fabc72 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\MortarObject.cs" /> <Compile Include="Objects\CannonObject.cs" /> <Compile Include="Objects\GoldPenguinObject.cs" /> <Compile Include="Objects\HealthGeneratorObject.cs" /> |
