Exemple #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            TargetElapsedTime = TimeSpan.FromTicks(333333);

            intro = new Introduction();
            instruct = new Instructions();
            instruct2 = new Instructions2();
            gameover = new GameOver();
            timex = new TimeExpired(); // instantiate menus

            // use the whole screen
            graphics.IsFullScreen = true;

            game_engine = new GameEngine(timex, gameover);
        }
        //*****************************************************//
        public GameEngine(TimeExpired t, GameOver g)
        {
            backpackmenu = new Backpack();
            timex = t;
            gameOver = g;

            character_sprite = new Sprite[(int)weaponType.GRENADE];
            character_sprite[(int)weaponType.NONE] = new Sprite();
            character_sprite[(int)weaponType.SWORD] = new Sprite();
            character_sprite[(int)weaponType.LASER] = new Sprite();

            monster_texture = new Texture2D[(int)enemyType.NUM_ENEM];

            bullet_sprite = new Sprite();
            sword_sprite = new Sprite();

            game_state = new GameState();
            game_state.local_player = new Player(33, 0, 32, 36);
            game_state.monster_engine = new MonsterEngine(game_state);
            game_state.coll_engine = new CollisionEngine(game_state);
            game_state.fx_engine = new EffectsEngine(game_state);
            game_state.obj_mang = new ObjectManager(game_state);
            //instantiate each type of object, respectively

            game_state.local_player.col_tok = game_state.coll_engine.register_object(game_state.local_player, ColType.PLAYER);
        }
        //*****************************************************//
        public GameEngine(TimeExpired t, GameOver g)
        {
            backpackmenu = new Backpack();
            timex = t;
            gameOver = g;

            character_sprite = new Sprite[(int)weaponType.GRENADE];
            character_sprite[(int)weaponType.NONE] = new Sprite();
            character_sprite[(int)weaponType.SWORD] = new Sprite();
            character_sprite[(int)weaponType.LASER] = new Sprite();

            monster_texture = new Texture2D[(int)enemyType.NUM_ENEM];

            bullet_sprite = new Sprite();
            sword_sprite = new Sprite();

            game_state = new GameState();
            game_state.local_player = new Player(33, 0, 32, 36);
            //game_state.local_player.setWeapon(weaponType.SWORD);
            game_state.monster_engine = new MonsterEngine(game_state);
            game_state.coll_engine = new CollisionEngine(game_state);
            game_state.fx_engine = new EffectsEngine(game_state);
            game_state.obj_mang = new ObjectManager(game_state);

            game_state.local_player.col_tok = game_state.coll_engine.register_object(game_state.local_player, ColType.PLAYER);

            //Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            //TargetElapsedTime = TimeSpan.FromTicks(333333);
        }