mMap.CenterCell = new Vector2(currentCenterX,currentCenterY);\r
//Debugging... Spawn eight projectiles.\r
//Diagonals\r
- \r
+ /*\r
mProjectiles.Add(new Projectile(mMap, everything, new Vector2(5,5), 10, 10, 300, 300));\r
mProjectiles.Add(new Projectile(mMap, everything, new Vector2(-5, 5), 10, 10, 300, 300));\r
mProjectiles.Add(new Projectile(mMap, everything, new Vector2(5, -5), 10, 10, 300, 300));\r
mProjectiles.Add(new Projectile(mMap, everything, new Vector2(-5, 0), 10, 10, 300, 300));\r
mProjectiles.Add(new Projectile(mMap, everything, new Vector2(5, 0), 10, 10, 300, 300));\r
mProjectiles.Add(new Projectile(mMap, everything, new Vector2(0, -5), 10, 10, 300, 300));\r
- \r
+ */\r
\r
\r
// TODO: use this.Content to load your game content here\r
{\r
if(state.keysDown[i].Contains(Keys.Enter))\r
{\r
- mCharacters[i] = (new Human(mMap, "", everything));\r
+ mCharacters[i] = (new Human(mMap, "", everything, everything, this));\r
mCharacters[i].GridX = mMap.GetStartingPositionForPlayer(i+1).X;\r
mCharacters[i].GridY = mMap.GetStartingPositionForPlayer(i+1).Y;\r
}\r
mCharacters[i].Draw(spriteBatch);\r
} \r
}\r
-\r
+ /*\r
public void AddCharacters(IPlayer player)\r
{\r
mCharacters[mCharacters.Length] = player;\r
//mCharacters.Add(player);\r
}\r
+ */\r
+ public void AddProjectiles(Projectile projectile)\r
+ {\r
+ mProjectiles.Add(projectile);\r
+ }\r
}\r
}\r
\r
int pixelY;\r
bool visible;\r
int movementCoolDown;\r
+ Display theDisplay;\r
+ int projectileSpeed;\r
\r
- public Human(Map _theMap, String Name, Texture2D model)\r
+ public Human(Map _theMap, String Name, Texture2D model, Texture2D projectile, Display mDisplay)\r
{\r
theMap = _theMap;\r
CharName = Name;\r
+ theDisplay = mDisplay;\r
\r
movementSpeed = 12; // randomly set now\r
health = 100;\r
//default state\r
state = State.up;\r
charModel = model;\r
+ projectileModel = projectile;\r
movementCoolDown = movementSpeed;\r
+ projectileSpeed = 30;\r
}\r
\r
public void LoadContent(ContentManager contentManager)\r
// move up\r
else if (keysPressed.Contains<Keys>(Keys.Up) && theMap.IsCellOpen(gridX, gridY - 1))\r
{\r
+ state = State.up;\r
gridY -= 1;\r
movementCoolDown = movementSpeed;\r
}\r
// move down\r
else if (keysPressed.Contains<Keys>(Keys.Down) && theMap.IsCellOpen(gridX, gridY + 1))\r
{\r
+ state = State.down;\r
gridY += 1;\r
movementCoolDown = movementSpeed;\r
}\r
// move left\r
else if (keysPressed.Contains<Keys>(Keys.Left) && theMap.IsCellOpen(gridX - 1, gridY))\r
{\r
+ state = State.left;\r
gridX -= 1;\r
movementCoolDown = movementSpeed;\r
}\r
// move right\r
else if (keysPressed.Contains<Keys>(Keys.Right) && theMap.IsCellOpen(gridX + 1, gridY))\r
{\r
+ state = State.right;\r
gridX += 1;\r
movementCoolDown = movementSpeed;\r
}\r
//TODO spawn projectile... needs to be added to display though\r
if (state == State.up)\r
{\r
- \r
+ theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, new Vector2(0, -projectileSpeed), GridX, GridY));\r
+ }\r
+ if (state == State.down)\r
+ {\r
+ theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, new Vector2(0, projectileSpeed), GridX, GridY + 1));\r
+ }\r
+ if (state == State.right)\r
+ {\r
+ theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, new Vector2(projectileSpeed, 0), GridX +1, GridY));\r
+ }\r
+ if (state == State.left)\r
+ {\r
+ theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, new Vector2(-projectileSpeed, 0), GridX, GridY));\r
}\r
}\r
}\r
Texture2D _projectileModel,\r
Vector2 _velocity,\r
int _gridX,\r
- int _gridY,\r
+ int _gridY)\r
+ /*,\r
int _pixelX,\r
- int _pixelY)\r
+ int _pixelY)*/\r
{\r
theMap = _currentMap;\r
projectileModel = _projectileModel;\r
velocity = _velocity;\r
gridX = _gridX;\r
gridY = _gridY;\r
- pixelX = _pixelX;\r
- pixelY = _pixelY;\r
+ pixelX = _gridX * (int)Map.PixelsToUnitSquares;\r
+ pixelY = _gridY * (int)Map.PixelsToUnitSquares;\r
damage = 20;\r
}\r
public void Update(TimeSpan timespan)\r