예제 #1
0
        //Constructor
        public GameOverseer(int test_level, int screen_width, int screen_height, ContentManager content, Viewport viewport)
        {
            //Set up camera
            camera = new Camera(viewport);

            //Load a level
            level        = content.Load <Texture2D>("Levels/lvl" + current_level + ".png");
            level_width  = level.Width;
            level_height = level.Height;
            blocks       = new Block[level_width, level_height];
            generate_level();

            player             = new Player(new Vector2(350, 100));
            particle_manager   = new ParticleManager();
            this.current_level = test_level;
            if (test_level == 0)
            {
                //Debug mode
            }

            map                  = new MapPortal(Vector2.Zero);
            starfield            = new Starfield(1000, 800);
            asteroid             = new Asteroid(Constant.asteroid, player);
            past_player_position = Vector2.Zero;

            solar_systems = new List <SolarSystem>();
            generate_planetary_systems();

            rogue        = new Rogue(new Vector2(0, 0), player);
            mother_ships = new List <MotherShip>();
            score        = 0;
        }
예제 #2
0
        public void update(GameTime gameTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            //player_level_collision();
            player.update(gameTime, spriteBatch);
            asteroid.update(graphics, gameTime);
            camera_updates();
            spawn += (float)gameTime.ElapsedGameTime.TotalSeconds;
            foreach (Enemy enemy in enemies)
            {
                enemy.Update(graphics, gameTime);
                if (enemy.isEnemyDead() == true)
                {
                    score     += 7;
                    enemy.dead = false;
                }
            }
            load_enemies(solar_systems[0].system_center);
            particle_manager.update(gameTime);
            spawn_motherships(gameTime, solar_systems[0].system_center);
            for (int i = 0; i < mother_ships.Count; i++)
            {
                mother_ships[i].Update(graphics, gameTime);
            }

            keyboard = Keyboard.GetState();
            if (keyboard.IsKeyDown(Keys.R))
            {
                apply_screen_shake();
            }

            map.update(gameTime, player.get_base_position());

            //If hit apply shake
            if (Constant.shake)
            {
                apply_screen_shake();
                Constant.shake = false;
            }

            Vector2 diff = player.position - past_player_position;

            starfield.update(gameTime, diff);
            past_player_position = player.position;

            for (int i = 0; i < solar_systems.Count; i++)
            {
                solar_systems[i].update(gameTime);
            }

            rogue.update(gameTime, player.position);
            if (rogue.dead == true)
            {
                addRougeScore();
                rogue = new Rogue(new Vector2(0, 0), player);
                counter--;
            }
        }