public EDM(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { cursor = new Cursor(); fenetre = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); //taille de la fenetre MediaPlayer.IsMuted = true; text = new textbox(new Rectangle(game.Window.ClientBounds.Width / 3, game.Window.ClientBounds.Height / 3, 200, 100)); }
public GamePlayer(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, int speed, Vector2 position, Texture2D image, gamemain main, textbox text, bool language) : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, speed, position, image) { equipement = new item[4]; dash = false; invulnerable = false; precInvulnarable = false; timer_invulnarable = 600; timer_inv2 = 10; timer_dash = 2; langue = language; CanMove = 0; this.main = main; this.text = text; spriteFont = ressource.ecriture; position_pv.X = 300; position_pv.Y = 0; this.Direction = Direction.None; attaque = 10; defense = 10; magie = 10; Endurance = 100; Mana = 100; Pv = 100; timer_endurance = 0; sort_selec = 1; obj_selec = 1; active_sort = new sort(ressource.boule_de_feu, this); click_down = false; levelup = false; nb_amelioration = 0; inventaire = new item[5, 5]; nb_objet = new int[25]; HitBox = new Rectangle((int)position.X, (int)position.Y, 32, 32); in_action = false; text.Is_shown = false; speed_max = Speed; }
public EDM(Game game, SpriteBatch spriteBatch, bool language) : base(game, spriteBatch) { XmlReader reader; reader = XmlReader.Create("Francais.xml"); if (!language) { reader = XmlReader.Create("English.xml"); } while (reader.Read()) while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.Name == "pos") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op1 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "debut") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op2 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "err") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op3 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "tuto") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op4 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "tuile") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op5 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "map") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op6 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "mob") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op7 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "messa") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op8 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "poser") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op9 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "ouvrir") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op10 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "ajouter") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op11 = reader.Value.ToString(); } reader.Read(); } } cursor.langue = language; fenetre = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); //taille de la fenetre MediaPlayer.IsMuted = true; text = new textbox(new Rectangle(game.Window.ClientBounds.Width / 3, game.Window.ClientBounds.Height / 3, 200, 100)); message = new textbox(new Rectangle(game.Window.ClientBounds.Width / 8, 2 * game.Window.ClientBounds.Height / 3, 600, 200)); message.Is_shown = false; current_tile = new Tile(0, 0, 0); tileset = new Rectangle(fenetre.Width - ressource.objet_map.Width, 0, ressource.objet_map.Width, ressource.objet_map.Height); listes_map = new Map[5, 5]; nb = 0; actuel = new Point(); selec = false; }
public menudeux(Game game, SpriteBatch spritebatch,ref textbox Box) : base(game, spritebatch) { box = Box; selec = false; }
protected override void LoadContent() { box = new textbox(new Rectangle(305, 200, 200, 50)); ressource.loadcontent(Content); spriteBatch = new SpriteBatch(GraphicsDevice); creation = new creat_perso(this, spriteBatch, ressource.pixel,language); Components.Add(creation); creation.hide(); gameover = new GameOverScreen(this, main, spriteBatch, ressource.ecriture, ressource.gameover, language); Components.Add(gameover); gameover.hide(); edm = new EDM(this, spriteBatch, language); Components.Add(edm); edm.hide(); pause = new menudepause(this, spriteBatch, ressource.ecriture, ressource.pixel, language); Components.Add(pause); pause.hide(); menu = new menu(this, spriteBatch, Content.Load<SpriteFont>("SpriteFont"), ressource.templar, language); Components.Add(menu); menu.hide(); //main = new gamemain(this, spriteBatch, activeScreen, new Donjon(@"Donjons\" + creation.donjon,false), false, ""); //Components.Add(main); //main.hide(); menudujeu = new menudujeu(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.th, language); Components.Add(menudujeu); menudujeu.hide(); Option = new option(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.option, language); Components.Add(Option); Option.hide(); inventaire = new Inventaire(this, spriteBatch, main, language); Components.Add(inventaire); inventaire.hide(); activeScreen = menu; activeScreen.Show(); MediaPlayer.Play(ressource.menu); MediaPlayer.IsRepeating = true; MediaPlayer.IsMuted = true; SoundEffect.MasterVolume = 0f; }
public void Update(GameTime gametime, string path, string path_coll, string path_message, string path_mob, string path_box, string path_coffre, textbox text) { lastKeyboardState = keyboardState; keyboardState = Keyboard.GetState(); if (Data.mouseState.RightButton == ButtonState.Pressed && Data.prevMouseState.RightButton == ButtonState.Released && new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(new Rectangle(0, 0, 16 * 25, 16 * 18)) && text.Is_shown == false) { if (Coffres[Data.mouseState.X / 16, Data.mouseState.Y / 16] != null) { cursor.position = false; cursor.selected = false; cursor.selec_obj = false; if (active_coffre != null) active_coffre.is_open = false; prev_coffre = active_coffre; cursor.selec_obj = false; cursor.selected_mob = false; Coffres[Data.mouseState.X / 16, Data.mouseState.Y / 16].is_open = true; active_coffre = Coffres[Data.mouseState.X / 16, Data.mouseState.Y / 16]; } } if (Data.mouseState.LeftButton == ButtonState.Pressed && Data.prevMouseState.LeftButton == ButtonState.Released && !new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(new Rectangle(100, 100, 32 * 5, 32 * 5)) && !new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(new Rectangle(27 * 16, 48, 32 * 7, 32 * 7)) && text.Is_shown == false && cursor.position == false && active_coffre != null && active_coffre.is_open == true) { active_coffre.is_open = false; } else if (Data.mouseState.LeftButton == ButtonState.Pressed && Data.prevMouseState.LeftButton == ButtonState.Released && new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(new Rectangle(0, 0, 16 * 25, 16 * 18)) && text.Is_shown == false && cursor.position == false && cursor.selected == true) { objet[(int)(Data.mouseState.X) / 16, (int)(Data.mouseState.Y) / 16] = cursor.iD; if (cursor.iD != new Vector2(0, 2) && cursor.iD != new Vector2(1, 2) && cursor.iD != new Vector2(0, 4) && cursor.iD != new Vector2(0, 7) && cursor.iD != new Vector2(0, 5) && cursor.iD != new Vector2(1, 4) && cursor.iD != new Vector2(0, 6) && cursor.iD != new Vector2(1, 7) && cursor.iD != new Vector2(1, 6) && cursor.iD != new Vector2(1, 5) && cursor.iD != new Vector2(1, 0) && cursor.iD != new Vector2(1, 4) && cursor.iD != new Vector2(2, 0)) { // tilelist[(int)(Data.mouseState.X) / 16, (int)(Data.mouseState.Y) / 16] = new Tile((int)cursor.iD.X, (int)cursor.iD.Y, 1); colision[(int)(Data.mouseState.X) / 16, (int)(Data.mouseState.Y) / 16] = 1; if (cursor.iD == new Vector2(0, 0)) { Coffres[Data.mouseState.X / 16, Data.mouseState.Y / 16] = new Coffre(new Vector2(Data.mouseState.X - Data.mouseState.X % 32, Data.mouseState.Y - Data.mouseState.Y % 32)); cursor.ecrire_coffre(path_coffre, this); } } else { // tilelist[(int)(Data.mouseState.X) / 16, (int)(Data.mouseState.Y) / 16] = new Tile((int)cursor.iD.X, (int)cursor.iD.Y, 0); colision[(int)(Data.mouseState.X) / 16, (int)(Data.mouseState.Y) / 16] = 0; } cursor.ecrire_coffre(path_coffre, this); ecrire_objet(path); ecrire_coll(path_coll); ecrire_message(path_message); ecrire_box(path_box); } else if (Data.mouseState.LeftButton == ButtonState.Pressed && Data.prevMouseState.LeftButton == ButtonState.Released && new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(new Rectangle(0, 0, 16 * 25, 16 * 18)) && text.Is_shown == false && cursor.position == false && cursor.selected_mob == true) { mob[(int)(Data.mouseState.X) / 16, (int)(Data.mouseState.Y) / 16] = cursor.iD; ecrire_mob(path_mob); } }
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; }