--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+using Microsoft.Xna.Framework;\r
+using Microsoft.Xna.Framework.Content;\r
+using Microsoft.Xna.Framework.Graphics;\r
+using Microsoft.Xna.Framework.Input;\r
+\r
+namespace CarFire\r
+{\r
+ public class Display\r
+ {\r
+ List<Projectile> mProjectiles = new List<Projectile>();\r
+ List<Character> mCharacters = new List<Character>();\r
+ Map mMap;\r
+ public Display()\r
+ {\r
+ /*\r
+ mMap = aMap;\r
+ mCharacters = characters;\r
+ */\r
+ }\r
+\r
+ /// <summary>\r
+ /// LoadContent will be called once per game and is the place to load\r
+ /// all of your content.\r
+ /// </summary>\r
+ public void LoadContent(ContentManager contentManager)\r
+ {\r
+ Texture2D everything = contentManager.Load<Texture2D>("cs");\r
+ mMap = contentManager.Load<Map>("Maps/stable");\r
+ Map.DefaultTile = contentManager.Load<Texture2D>("default");\r
+ mMap.CenterCell = new Vector2(5,5);\r
+ //List<object> entities = mMap.GetAllEntities();\r
+ mProjectiles.Add(new Projectile(mMap, everything, new Vector2(5,5), 10, 10, 300, 300));\r
+ // TODO: use this.Content to load your game content here\r
+ }\r
+\r
+ /// <summary>\r
+ /// UnloadContent will be called once per game and is the place to unload\r
+ /// all content.\r
+ /// </summary>\r
+ public void UnloadContent()\r
+ {\r
+ // TODO: Unload any non ContentManager content here\r
+ }\r
+\r
+ /// <summary>\r
+ /// Allows the game to run logic such as updating the world,\r
+ /// checking for collisions, gathering input, and playing audio.\r
+ /// </summary>\r
+ /// <param name="gameTime">Provides a snapshot of timing values.</param>\r
+ public void Update(TimeSpan timespan)\r
+ {\r
+ \r
+ foreach (Projectile projectile in mProjectiles)\r
+ {\r
+ projectile.Update(timespan);\r
+ }\r
+ //Check for collisons\r
+ foreach (Character character in mCharacters)\r
+ {\r
+ foreach (Projectile projectile in mProjectiles)\r
+ {\r
+ if (projectile.GridX == character.GridX && projectile.GridY == character.GridY)\r
+ {\r
+ //Debug - not sure if you can remove while doing for each\r
+ //Alternative - while loop, and decrement projectile counter if projectile is removed.\r
+ mProjectiles.Remove(projectile);\r
+ character.Health -= projectile.Damage;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// This is called when the game should draw itself.\r
+ /// </summary>\r
+ /// <param name="gameTime">Provides a snapshot of timing values.</param>\r
+ public void Draw(SpriteBatch spriteBatch)\r
+ {\r
+ mMap.Draw(spriteBatch);\r
+ foreach(Projectile projectile in mProjectiles)\r
+ {\r
+ projectile.Draw(spriteBatch);\r
+ \r
+ }\r
+ foreach(Character character in mCharacters)\r
+ {\r
+ character.Draw(spriteBatch);\r
+ }\r
+\r
+ \r
+ }\r
+ }\r
+}\r
+\r