示例#1
0
 void RestartGameMenuEntrySelected(object sender, PlayerIndexEvent e)
 {
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen());
 }
示例#2
0
        private void UpdateCollison()
        {
            Rectangle player;
            Rectangle enemyRockStoneSpace;
            Rectangle enemyCruncherSpace;
            Rectangle enemySkullStoneSpace;
            Rectangle enemySpiderSpace;
            Rectangle projectile;

            player = new Rectangle((int)playerLocation.X, (int)playerLocation.Y, texture.Width / 3, texture.Height / 9);
            for (int x = 0; x < enemiesRockStone.Count; x++)
            {
                enemyRockStoneSpace = new Rectangle((int)enemiesRockStone[x].Position.X, (int)enemiesRockStone[x].Position.Y, enemiesRockStone[x].Width, enemiesRockStone[x].Height);
                if (player.Intersects(enemyRockStoneSpace))
                {
                    score += enemiesRockStone[x].Value;
                    animatedSprite.Health -= enemiesRockStone[x].Damage;
                    enemiesRockStone.RemoveAt(x);
                    if (animatedSprite.Health == 0)
                    {
                        ScreenManager.AddScreen(new GameOverScreen(), ControllingPlayer);
                    }
                }
            }
            for (int x = 0; x < enemiesCrucher.Count; x++)
            {
                enemyCruncherSpace = new Rectangle((int)enemiesCrucher[x].Position.X, (int)enemiesCrucher[x].Position.Y, enemiesCrucher[x].Width, enemiesCrucher[x].Height);
                if (player.Intersects(enemyCruncherSpace))
                {
                    score += enemiesCrucher[x].Value;
                    animatedSprite.Health -= enemiesCrucher[x].Damage;
                    enemiesCrucher.RemoveAt(x);
                    if (animatedSprite.Health == 0)
                    {
                        ScreenManager.AddScreen(new GameOverScreen(), ControllingPlayer);
                    }
                }
            }
            for (int x = 0; x < enemiesSkullStone.Count; x++)
            {
                enemySkullStoneSpace = new Rectangle((int)enemiesSkullStone[x].Position.X, (int)enemiesSkullStone[x].Position.Y, enemiesSkullStone[x].Width, enemiesSkullStone[x].Height);
                if (player.Intersects(enemySkullStoneSpace))
                {
                    score += enemiesSkullStone[x].Value;
                    animatedSprite.Health -= enemiesSkullStone[x].Damage;
                    enemiesSkullStone.RemoveAt(x);
                    if (animatedSprite.Health == 0)
                    {
                        ScreenManager.AddScreen(new GameOverScreen(), ControllingPlayer);
                    }
                }
            }
            for (int x = 0; x < enemiesSpider.Count; x++)
            {
                enemySpiderSpace = new Rectangle((int)enemiesSpider[x].Position.X, (int)enemiesSpider[x].Position.Y, enemiesSpider[x].Width, enemiesSpider[x].Height);
                if (player.Intersects(enemySpiderSpace))
                {
                    score += enemiesSpider[x].Value;
                    animatedSprite.Health -= enemiesSpider[x].Damage;
                    enemiesSpider.RemoveAt(x);
                    if (animatedSprite.Health == 0)
                    {
                        ScreenManager.AddScreen(new GameOverScreen(), ControllingPlayer);
                    }
                }
            }
            for (int x = 0; x < projectiles.Count; x++)
            {
                projectile = new Rectangle((int)projectiles[x].Position.X, (int)projectiles[x].Position.Y, projectiles[x].Width, projectiles[x].Height);
                for (int y = 0; y < enemiesRockStone.Count; y++)
                {
                    enemyRockStoneSpace = new Rectangle((int)enemiesRockStone[y].Position.X, (int)enemiesRockStone[y].Position.Y, enemiesRockStone[y].Width, enemiesRockStone[y].Height);
                    if (projectile.Intersects(enemyRockStoneSpace))
                    {
                        score += enemiesRockStone[y].Value;
                        enemiesRockStone.RemoveAt(y);
                        projectiles.RemoveAt(x);
                        if (score >= 10000)
                        {
                            LoadingScreen.Load(ScreenManager, true, ControllingPlayer, new GameplayLevel5Screen());
                        }
                    }
                }
                for (int y = 0; y < enemiesSkullStone.Count; y++)
                {
                    enemySkullStoneSpace = new Rectangle((int)enemiesSkullStone[y].Position.X, (int)enemiesSkullStone[y].Position.Y, enemiesSkullStone[y].Width, enemiesSkullStone[y].Height);
                    if (projectile.Intersects(enemySkullStoneSpace))
                    {
                        score += enemiesSkullStone[y].Value;
                        enemiesSkullStone.RemoveAt(y);
                        projectiles.RemoveAt(x);
                        if (score >= 10000)
                        {
                            LoadingScreen.Load(ScreenManager, true, ControllingPlayer, new GameplayLevel5Screen());
                        }
                    }
                }
                for (int y = 0; y < enemiesCrucher.Count; y++)
                {
                    enemyCruncherSpace = new Rectangle((int)enemiesCrucher[y].Position.X, (int)enemiesCrucher[y].Position.Y, enemiesCrucher[y].Width, enemiesCrucher[y].Height);
                    if (projectile.Intersects(enemyCruncherSpace))
                    {
                        score += enemiesCrucher[y].Value;
                        enemiesCrucher.RemoveAt(y);
                        projectiles.RemoveAt(x);
                        if (score >= 10000)
                        {
                            LoadingScreen.Load(ScreenManager, true, ControllingPlayer, new GameplayLevel5Screen());
                        }
                    }
                }
                for (int y = 0; y < enemiesSpider.Count; y++)
                {
                    enemySpiderSpace = new Rectangle((int)enemiesSpider[y].Position.X, (int)enemiesSpider[y].Position.Y, enemiesSpider[y].Width, enemiesSpider[y].Height);
                    if (projectile.Intersects(enemySpiderSpace))
                    {
                        score += enemiesSpider[y].Value;
                        enemiesSpider.RemoveAt(y);
                        projectiles.RemoveAt(x);
                        if (score >= 10000)
                        {
                            LoadingScreen.Load(ScreenManager, true, ControllingPlayer, new GameplayLevel5Screen());
                        }
                    }
                }
            }
        }
示例#3
0
 void QuitGameMenuEntrySelected(object sender, PlayerIndexEvent e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen());
 }