protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); gameLand = new GameLand(spriteBatch, height, width); gameLand.load(Content); bonuses = new Bonuses(spriteBatch, gameLand.H, gameLand.W); bonuses.load(Content, gameLand.GameBoard); enemys = new Enemys(Content, spriteBatch, 12, gameLand.H, gameLand.W); enemys.load(gameLand.GameBoard); hero = new Hero(Content.Load <Texture2D>("heroright"), new Vector2(3, 3), 1.7f); hero.Content = Content; userInterface = new UserInterface(spriteBatch); userInterface.Load(Content, height, width); }
public void CheckForMonsters(Enemys enemys) { for (int i = 0; i < enemys.MonsterCount; i++) { if (enemys.Monster[i] != null) { if (BoundingBox.Intersects(enemys.Monster[i].BoundingBox)) { if (armor > 0) { if (armor - enemys.Monster[i].Damage < 0) { armor = 0; } else { armor -= enemys.Monster[i].Damage; } } else { if (hp - enemys.Monster[i].Damage < 0) { hp = 0; } else { hp -= enemys.Monster[i].Damage; } } enemys.Monster[i] = null; enemys.MonsterCount = enemys.MonsterCount - 1; } } if (enemys.Zombie[i] != null) { if (BoundingBox.Intersects(enemys.Zombie[i].BoundingBox)) { if (armor > 0) { if (armor - enemys.Zombie[i].Damage < 0) { armor = 0; } else { armor -= enemys.Zombie[i].Damage; } } else { if (hp - enemys.Zombie[i].Damage < 0) { hp = 0; } else { hp -= enemys.Zombie[i].Damage; } } enemys.Zombie[i] = null; enemys.MonsterCount = enemys.MonsterCount - 1; } } if (enemys.FlyingMonster[i] != null) { if (BoundingBox.Intersects(enemys.FlyingMonster[i].BoundingBox)) { if (armor > 0) { if (armor - enemys.FlyingMonster[i].Damage < 0) { armor = 0; } else { armor -= enemys.FlyingMonster[i].Damage; } } else { if (hp - enemys.FlyingMonster[i].Damage < 0) { hp = 0; } else { hp -= enemys.FlyingMonster[i].Damage; } } enemys.FlyingMonster[i] = null; enemys.MonsterCount = enemys.MonsterCount - 1; } } } }