From 778869ce447cf33f686b01c82a693f5685f8fc7b Mon Sep 17 00:00:00 2001 From: Niklas Ulf Anders Cullberg Date: Wed, 31 Oct 2012 19:44:50 +0100 Subject: [PATCH] BUB now appears. And Rocket Texture. --- DepthsBelow/DepthsBelow/Core.cs | 2 +- DepthsBelow/DepthsBelow/Map.cs | 2 +- DepthsBelow/DepthsBelow/Shot.cs | 196 +++++++++--------- DepthsBelow/DepthsBelow/SmallEnemy.cs | 24 +-- .../DepthsBelowContent.contentproj | 7 + .../images/RocketProjectile.png | Bin 0 -> 3462 bytes .../DepthsBelowContent/maps/prototyp2.tmx | 15 +- 7 files changed, 126 insertions(+), 120 deletions(-) create mode 100644 DepthsBelow/DepthsBelowContent/images/RocketProjectile.png diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs index 0d796de..74ba832 100755 --- a/DepthsBelow/DepthsBelow/Core.cs +++ b/DepthsBelow/DepthsBelow/Core.cs @@ -101,7 +101,7 @@ namespace DepthsBelow lightRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents); sceneRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); - Map = Content.Load("maps/prototyp"); + Map = Content.Load("maps/prototyp2"); //Map = Content.Load("maps/Aztek.Test"); //Map = Content.Load("maps/Cave.Level1"); diff --git a/DepthsBelow/DepthsBelow/Map.cs b/DepthsBelow/DepthsBelow/Map.cs index e4e6bbf..5c8dd0f 100755 --- a/DepthsBelow/DepthsBelow/Map.cs +++ b/DepthsBelow/DepthsBelow/Map.cs @@ -100,7 +100,7 @@ namespace DepthsBelow } if (mapObject.Type == "DelayedMonsterSpawn" || mapObject.Type == "DelayedEnemySpawn") { - var enemy = new MonsterSpawn("Monster", 200, 8, ref core.Swarm); + var enemy = new MonsterSpawn("Monster", 200, 4, ref core.Swarm); var mapObjectPos = new Vector2(mapObject.Bounds.X, mapObject.Bounds.Y - Grid.TileSize); var mapObjectGridPos = Grid.WorldToGrid(mapObjectPos); enemy.X = mapObjectGridPos.X; diff --git a/DepthsBelow/DepthsBelow/Shot.cs b/DepthsBelow/DepthsBelow/Shot.cs index d623b5b..8ba52b5 100755 --- a/DepthsBelow/DepthsBelow/Shot.cs +++ b/DepthsBelow/DepthsBelow/Shot.cs @@ -1,99 +1,99 @@ -using System; -using System.Collections.Generic; -using DepthsBelow.Component; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; - -namespace DepthsBelow -{ - public class Shot : Entity - { - public Texture2D Texture; - public Color Color; - public static Point Origin; - string type = ""; - - Stat soldierStat; - - public Stat Stat - { - get { return soldierStat; } - set { soldierStat = value; } - } - - private bool _selected = false; //I guess as in "currently doing something" - - public bool select - { - get { return _selected; } - set - { - _selected = value; - } - } - - public List Volley; - - public Vector2 direction = Vector2.Zero; - - public Shot(Stat _soldierStat, string _type) - : base() - { - type = _type; - - if (Texture == null) - LoadContent(); - - Transform.World.Origin = new Vector2(16, 16); - - Stat = _soldierStat; - - this.Color = Color.White; - var rc = new SpriteRenderer(this) { Texture = Texture, Color = Color.White }; - AddComponent(rc); - - var cc = new Collision(this, 32, 32); - AddComponent(cc); - - } - public void LoadContent() - { - if (type == "Rocket") - { - Texture = GameServices.GetService().Load("images/Shot"); - } - else - { - Texture = GameServices.GetService().Load("images/Shot3"); - } - } - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - - float elapsed = gameTime.ElapsedGameTime.Milliseconds / 1000.0f; - List soldierCollisions = new List(); - - // HACK: Make this work properly with other speeds... - float speed = 4f; - Transform.World.Position += speed * direction; - - foreach (var entity in EntityManager.Entities) - { - if (entity is SmallEnemy) - { - if (this.GetComponent().Rectangle.Intersects(entity.GetComponent().Rectangle)) - { - if (Utility.AttackTest(Stat, entity, Utility.CalculateHitChance(Stat, this.Stat.Remember, entity))) - { - this.Remove(); - return; - } - } - } - } - } - } +using System; +using System.Collections.Generic; +using DepthsBelow.Component; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace DepthsBelow +{ + public class Shot : Entity + { + public Texture2D Texture; + public Color Color; + public static Point Origin; + string type = ""; + + Stat soldierStat; + + public Stat Stat + { + get { return soldierStat; } + set { soldierStat = value; } + } + + private bool _selected = false; //I guess as in "currently doing something" + + public bool select + { + get { return _selected; } + set + { + _selected = value; + } + } + + public List Volley; + + public Vector2 direction = Vector2.Zero; + + public Shot(Stat _soldierStat, string _type) + : base() + { + type = _type; + + if (Texture == null) + LoadContent(); + + Transform.World.Origin = new Vector2(16, 16); + + Stat = _soldierStat; + + this.Color = Color.White; + var rc = new SpriteRenderer(this) { Texture = Texture, Color = Color.White }; + AddComponent(rc); + + var cc = new Collision(this, 32, 32); + AddComponent(cc); + + } + public void LoadContent() + { + if (type == "Rocket") + { + Texture = GameServices.GetService().Load("images/RocketProjectile"); + } + else + { + Texture = GameServices.GetService().Load("images/Shot3"); + } + } + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + float elapsed = gameTime.ElapsedGameTime.Milliseconds / 1000.0f; + List soldierCollisions = new List(); + + // HACK: Make this work properly with other speeds... + float speed = 4f; + Transform.World.Position += speed * direction; + + foreach (var entity in EntityManager.Entities) + { + if (entity is SmallEnemy) + { + if (this.GetComponent().Rectangle.Intersects(entity.GetComponent().Rectangle)) + { + if (Utility.AttackTest(Stat, entity, Utility.CalculateHitChance(Stat, this.Stat.Remember, entity))) + { + this.Remove(); + return; + } + } + } + } + } + } } \ No newline at end of file diff --git a/DepthsBelow/DepthsBelow/SmallEnemy.cs b/DepthsBelow/DepthsBelow/SmallEnemy.cs index be78a79..c4b0c75 100755 --- a/DepthsBelow/DepthsBelow/SmallEnemy.cs +++ b/DepthsBelow/DepthsBelow/SmallEnemy.cs @@ -87,19 +87,17 @@ namespace DepthsBelow } public void LoadBoss() - { - Texture = GameServices.GetService().Load("images/Pineapple"); - GetComponent().Texture = Texture; - Transform.World.Origin = new Vector2(((float)Texture.Width) / 2f, ((float)Texture.Height) / 2f); - GetComponent().Offset = (new Vector2(Texture.Width / 2f, Texture.Height / 2f) - new Vector2(Grid.TileSize / 2, Grid.TileSize / 2)) * -1; - var stat = new Component.Stat(this) - { - Life = 500, - Defence = 15, - Strength = 70, - GetAim = 80, - GetDodge = 5 - }; + { + Texture = GameServices.GetService().Load("images/Pineapple"); + GetComponent().Texture = Texture; + Transform.World.Origin = new Vector2(((float)Texture.Width) / 2f, ((float)Texture.Height) / 2f); + GetComponent().Offset = (new Vector2(Texture.Width / 2f, Texture.Height / 2f) - new Vector2(Grid.TileSize / 2, Grid.TileSize / 2)) * -1; + GetComponent().MaxHP = 500; + GetComponent().Life = 500; + GetComponent().Defence = 15; + GetComponent().Strength = 70; + GetComponent().GetAim = 80; + GetComponent().GetDodge = 5; } public override void Update(GameTime gameTime) diff --git a/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj b/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj index 27e80fb..ee97c6c 100755 --- a/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj +++ b/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj @@ -255,6 +255,13 @@ MapProcessor + + + RocketProjectile + TextureImporter + TextureProcessor + +