示例#1
0
        protected Projectile CreateProjectile(int x, int y, Vector2 dir)
        {
            switch (projectileType)
            {
            case ProjectileType.Standard:
                return(new Projectile(TextureFactory.GetTexture("enemyBullet"), x, y, dir, false));

            case ProjectileType.Orange:
                return(new Projectile(TextureFactory.GetTexture("orangeBullet"), x, y, dir, false));

            case ProjectileType.Rope:
                return(new Projectile(TextureFactory.GetTexture("ropeBullet"), x, y, dir, false));

            case ProjectileType.Lazer:
                return(new Lazer(TextureFactory.GetTexture("enemyBullet"), x, y, dir, false));

            case ProjectileType.Pulsating:
                return(new PulsatingProjectile(TextureFactory.GetTexture("bullet4"), x, y, dir, false));

            case ProjectileType.Spinning:
                return(new SpinningProjectile(TextureFactory.GetTexture("bullet3"), x, y, dir, false));

            case ProjectileType.BlueFuzzyStandard:
                return(new Projectile(TextureFactory.GetTexture("bluefuzzyball"), x, y, dir, false)
                {
                    Scale = .0003f * Settings.GlobalDisplayWidth,
                    Speed = Settings.GlobalDisplayHeight / 360f
                });
            }
            return(new Projectile(TextureFactory.GetTexture("enemyBullet"), x, y, dir, false));
        }
示例#2
0
文件: Game1.cs 项目: DJ618/bullethell
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //make borderless window that matches size of screen

            base.Initialize();
            //settings = configParser.ParseSettings();
            StaticContentManager = Content;
            //Window.IsBorderless = true;
            settings.MatchWindowSize();
            settings.Apply();
            mainMenu.LoadMenuOptions();
            TextureFactory.LoadTextures();
            enemyManager = configParser.ParseEnemies();
            backGround   = new Background(TextureFactory.GetTexture("Space003"), new Rectangle(0, 0,
                                                                                               GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width,
                                                                                               GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height));
            backGround2 = new Background(TextureFactory.GetTexture("Space003"), new Rectangle(0, -GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height,
                                                                                              GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width,
                                                                                              GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height));

            enemyManager.OnSpawnProjectiles += SpawnEnemyProjectiles;
            enemyManager.OnSpawnEnemy       += AddEnemyToCollisionDetector;
            enemyManager.OnGameOver         += HandleGameOver;
            enemyManager.OnSpawnHealthPack  += HandleSpawnHealthPack;
        }
示例#3
0
文件: Game1.cs 项目: DJ618/bullethell
 private Projectile CreateHealthPack(int x, int y)
 {
     return(new Projectile(TextureFactory.GetTexture("healthpack"), x, y, new Vector2(0, 1), false)
     {
         Speed = 5,
         Scale = .0001f * Settings.GlobalDisplayWidth
     });
 }
示例#4
0
        private Texture2D GetEnemyTexture(string selection)
        {
            switch (selection)
            {
            case "ghost":
                return(TextureFactory.GetTexture(selection));

            case "monster":
                return(TextureFactory.GetTexture(selection));
            }
            return(TextureFactory.GetTexture("ghost"));
        }
示例#5
0
        private FirePattern ConstructFirePattern(string selection, ProjectileType projectileType)
        {
            var texture = TextureFactory.GetTexture("enemyBullet");

            switch (selection)
            {
            case "pulsatingblast":
                return(new PulsatingBlast(projectileType));

            case "spinningblast":
                return(new SpinningCircleBlast(projectileType));

            case "666":
                return(new Fire666(projectileType));

            case "123":
                return(new Fire123(projectileType));

            case "circle":
                return(new FireCircle(projectileType));

            case "rope":
                return(new FireRope(projectileType));

            case "doublerope":
                return(new FireDoubleRope(projectileType));

            case "triplerope":
                return(new FireTripleRope(projectileType));

            case "mcflurry":
                return(new FireMcFlurry(projectileType));

            case "none":
                return(new FireNone(projectileType));

            case "lazers":
                return(new FireLazers(projectileType));

            case "normal":
                return(new FireNormal(projectileType));

            default:
                return(new FireNone(projectileType));
            }
        }
示例#6
0
        public void DrawEndGame(Stats gameStats)
        {
            if (gameStats.playerHealth <= 0)
            {
                //lose
                var endpic = TextureFactory.GetTexture("black-screen-2");

                spriteBatch.Draw(endpic, new Vector2(0, 0));
                spriteBatch.DrawString(gameStats.scoreFont, "You lose.", new Vector2(Settings.GlobalDisplayWidth / 2, Settings.GlobalDisplayHeight / 2), Color.White);
            }
            //   elseif (UNKNOWN PARAMETER ATM)
            //   {
            //	//win
            //	spriteBatch.Draw(new Texture2D(GraphicsDevice, settings.DisplayWidth, settings.DisplayHeight),
            //		new Rectangle(0, 0, settings.DisplayWidth, settings.DisplayHeight), Color.Black);
            //	spriteBatch.DrawString(gameStats.scoreFont, "You Win!", new Vector2(settings.DisplayWidth - (float).15 * (settings.DisplayWidth), settings.DisplayHeight - (float).92 * (settings.DisplayHeight)), Color.White);
            //}
        }
示例#7
0
        public void DrawExplosion(Projectile p)
        {
            var   t     = TextureFactory.GetTexture("explosion");
            float scale = .01f * Settings.GlobalDisplayWidth / t.Width;

            if (p.Scale > scale)
            {
                scale = p.Scale * p.Texture.Width / t.Width;
            }
            if (p != null)
            {
                spriteBatch.Draw(t,
                                 p.ExplosionLoc,
                                 null, Color.White,
                                 0.0f, p.Origin,
                                 scale,
                                 p.SpriteEffect,
                                 p.ZDepth);
            }
        }
示例#8
0
        public void DrawStats(Stats gameStats, int playerHealth)
        {
            spriteBatch.DrawString(gameStats.scoreFont, "HiScore: " + gameStats.highScore, new Vector2(Settings.GlobalDisplayWidth - (float).15 * (Settings.GlobalDisplayWidth), Settings.GlobalDisplayHeight - (float).92 * (Settings.GlobalDisplayHeight)), Color.White);
            spriteBatch.DrawString(gameStats.scoreFont, "Score: " + gameStats.playerScore, new Vector2(Settings.GlobalDisplayWidth - (float).15 * (Settings.GlobalDisplayWidth), Settings.GlobalDisplayHeight - (float).88 * (Settings.GlobalDisplayHeight)), Color.White);
            spriteBatch.DrawString(gameStats.scoreFont, "Power: " + gameStats.power, new Vector2(Settings.GlobalDisplayWidth - (float).15 * (Settings.GlobalDisplayWidth), Settings.GlobalDisplayHeight - (float).80 * (Settings.GlobalDisplayHeight)), Color.White);

            spriteBatch.DrawString(gameStats.scoreFont, "Player: ", new Vector2(Settings.GlobalDisplayWidth - (float).15 * (Settings.GlobalDisplayWidth), Settings.GlobalDisplayHeight - (float).84 * (Settings.GlobalDisplayHeight)), Color.White);

            if (playerHealth >= 0)
            {
                gameStats.playerHealth = playerHealth;
                string currentHpStr = gameStats.playerHealth.ToString();
                currentHpStr = currentHpStr + "hp";
                var hpPic = TextureFactory.GetTexture(currentHpStr);
                DrawHpPicture(hpPic);
            }
            else
            {
                DrawEndGame(gameStats);
            }
        }