Пример #1
0
 public Camera(GraphicsDevice graphics, Vector2 _pos, Player _player, LevelManager _levelManager)
 {
     screenPos.X = graphics.Viewport.Width / 2;
     screenPos.Y = graphics.Viewport.Height / 2;
     pos = _pos;
     player = _player;
     zoom = 0.9f;
     levelManager = _levelManager;
 }
Пример #2
0
        public CharacterManager(Player p)
        {
            player = p;

            enemies = new List<Character>();
            enemyBullets = new List<Bullet>();
            playerBullets = new List<Bullet>();
            eggs = new List<Character>();
            effects = new List<Bullet>();

            removedEnemies = new List<Character>();
            removedEnemyBullets = new List<Bullet>();
            removedPlayerBullets = new List<Bullet>();
            removedEggs = new List<Character>();
            removedEffects = new List<Bullet>();

            deathTimerMax = 180;
            deathTimer = deathTimerMax;
            bombCounter = 0;
            bombCounterMax = 4;
        }
Пример #3
0
 public InputHandler(Player p)
 {
     player = p;
 }
Пример #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // load sprites and such
            playerSprite = Content.Load<Texture2D>("playership");
            playerBulletSprite = Content.Load<Texture2D>("playerbullet");

            starTex = new Texture2D[3];
            starTex[0] = Content.Load<Texture2D>("star1");
            starTex[1] = Content.Load<Texture2D>("star2");
            starTex[2] = Content.Load<Texture2D>("star3");

            backTex = new Texture2D[4];
            backTex[0] = Content.Load<Texture2D>("background1");
            backTex[1] = Content.Load<Texture2D>("background2");
            backTex[2] = Content.Load<Texture2D>("background3");
            backTex[3] = Content.Load<Texture2D>("background4");

            earthTex = Content.Load<Texture2D>("earth");

            enemySprites = new Texture2D[4];
            enemySprites[0] = Content.Load<Texture2D>("enemy1");
            enemySprites[1] = Content.Load<Texture2D>("enemy2");
            enemySprites[2] = Content.Load<Texture2D>("enemy3");
            enemySprites[3] = Content.Load<Texture2D>("boss");

            eggSprite = Content.Load<Texture2D>("egg");
            hollowEggSprite = Content.Load<Texture2D>("hollowegg");
            portalSprite = Content.Load<Texture2D>("portal");

            HPBoxSprite = Content.Load<Texture2D>("hpbox");

            arrowSprite = Content.Load<Texture2D>("arrow");
            sparkSprite = Content.Load<Texture2D>("spark");
            explosionSprite = Content.Load<Texture2D>("explosion");

            levelManager = new LevelManager(starTex, backTex, earthTex);

            player = new Player(playerSprite, new Vector2(0.0f, 0.0f),
                new Vector2(0.0f, 0.0f), 200, levelManager);
            characterManager = new CharacterManager(player);
            inputHandler = new InputHandler(player);

            player.setCharacterManager(characterManager);
            levelManager.setCharacterManager(characterManager);

            characterManager.setBulletSprite(playerBulletSprite);
            characterManager.setEnemySprites(enemySprites);
            characterManager.setEggSprite(eggSprite);
            characterManager.setPortalSprite(portalSprite);
            characterManager.setArrowSprite(arrowSprite);
            characterManager.setExplosionSprite(explosionSprite);
            characterManager.setSparkSprite(sparkSprite);
            characterManager.setLevelManager(levelManager);

            cam = new Camera(GraphicsDevice, new Vector2(0.0f, 0.0f), player, levelManager);
            characterManager.setCam(cam);

            soundManager = new SoundManager(Content);
            levelManager.setSoundManager(soundManager);
            characterManager.setSoundManager(soundManager);

            font = Content.Load<SpriteFont>("font");

            intro = new string[6];
            intro[0] = "This is ground control... your circuit's dead, there's something wrong...\n\n\n";
            intro[1] = "On a routine mission, you stumble into a strange portal and find yourself";
            intro[2] = "-alone-";
            intro[3] = "in a parallel dimension.";
            intro[4] = "Search for the space eggs to survive and find your way home.";
            intro[5] = "Good luck !";

            end = new string[4];
            end[0] = "In your absence, the earth was destroyed.";
            end[1] = "You are now";
            end[2] = "-alone-";
            end[3] = "\n\nTHE END";

            gameOver = false;

            levelManager.initLevel(0);
            Game1.points = 0;
        }