Example #1
0
        public gamemain(Game game, SpriteBatch spriteBatch, GameScreen activescreen)
            : base(game, spriteBatch)
        {
            #region init du jeu

            x = new Random();

            liste_sort = new List<sort>();
            list_zombi = new List<NPC>();
            Walls = new List<wall>();
            personnage = new List<Personnage>();
            liste_objet_map = new List<potion>();

            position_joueur = new Vector2(100, 100);

            localPlayer = new GamePlayer(34, 61, 4, 5, 2, 8, position_joueur, 100, ressource.sprite_player, this);
            localPlayer.Niveau = 1;

            pop_time = 0;
            score = 0;
            count_dead_zombi = 0;

            keyboard = new KeyboardState();

            #endregion init du jeu

            map = new switch_map(localPlayer, this);

            fenetre = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); //taille de la fenetre

            HUD = new HUD(localPlayer, this);

            # region media_player;
            MediaPlayer.Play(ressource.main_theme);
            MediaPlayer.Volume = 0.56f;
            MediaPlayer.IsRepeating = true;
               // SoundEffect.MasterVolume = 0.6f;
            # endregion
        }
Example #2
0
        public gamemain(Game game, SpriteBatch spriteBatch, GameScreen activescreen, Donjon donjon, bool is2p, string ip, string name_donjon, bool language)
            : base(game, spriteBatch)
        {
            victoire = false;
            langue = language;
            nom_donjon = name_donjon;
            fenetre = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); //taille de la fenetre
            text = new textbox(new Rectangle(0, 18 * 32 + 7, 200, 100));
            text.Is_shown = false;
            #region init du jeu
            x = new Random();
            keyboard = new KeyboardState();
            liste_sort = new List<sort>();
            //ICI POUR LOADMOB
            //FIN ICI
            Walls = new List<wall>();
            personnage = new List<Personnage>();
            liste_objet_map = new List<potion>();
            if (is2p)
            {
                position_joueur = new Vector2(32, 32);
                localPlayer = new GamePlayer(32, 48, 4, 8, 2, 15, 2, position_joueur, ressource.sprite_player, this, text, language);
                localPlayer.Niveau = 1;
            }
            if (!is2p)
            {
                position_joueur = donjon.position_J;
                localPlayer = new GamePlayer(32, 48, 4, 8, 2, 15, 2, position_joueur, ressource.sprite_player, this, text, language);
                localPlayer.Niveau = 1;
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        if (donjon.Map[i, j] != null)
                            donjon.Map[i, j].load_mob(@"Donjons\" + @name_donjon + @"\Map" + donjon.Map[i, j].Nb + @"\creature" + @".txt", this);
                    }
                }
            }
            donj = donjon;

            if (!is2p)
            {

                map = new switch_map(localPlayer/*, this*/, donjon, name_donjon);
                map.x = (int)donjon.map.X;
                map.y = (int)donjon.map.Y;
                mapx = map.x;
                mapy = map.y;
                list_zombi = map.Active_Map.monstre;
                HUD = new HUD(localPlayer, this);
            }
            pop_time = 0;
            score = 0;
            count_dead_zombi = 0;
            #endregion init du jeu
            # region media_player;
            MediaPlayer.Play(ressource.main_theme);
            MediaPlayer.Volume = 0.56f;
            MediaPlayer.IsRepeating = true;
            # endregion
            noir.A = 200;
            noir.B = noir.G = noir.R = 0;
            white = Color.White;
            white.A = 120;
            effect = new BasicEffect(game.GraphicsDevice);
            same_map = true;
        }
Example #3
0
 public void AddHUD()
 {
     HUD = new HUD(localPlayer, this);
 }