예제 #1
0
파일: Sauvegarde.cs 프로젝트: kylox/Templar
 public Sauvegarde(switch_map map, GamePlayer player)
 {
     this.Mapi = map;
     this.Player = player;
     fichier = new FileStream(@"save/Save.txt", FileMode.OpenOrCreate,FileAccess.Write);
     stream = new BinaryWriter(fichier);
 }
예제 #2
0
파일: sort.cs 프로젝트: kylox/Templar
        public sort(Texture2D image, GamePlayer player)
        {
            texture = image;
            Player = player;
            position = player.Position;
            Hitbox_object = new Rectangle((int)position.X, (int)position.Y, image.Width, image.Height);

            switch (Player.frameline)
            {
                case 3:
                    object_direction = Direction.Up;
                    break;

                case 1:
                    object_direction = Direction.Down;
                    break;

                case 2:
                    object_direction = Direction.Left;
                    break;

                case 4:
                    object_direction = Direction.Right;
                    break;
            }
        }
예제 #3
0
파일: NPC.cs 프로젝트: tchiiikun/Templar
 public NPC(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, Vector2 position,
     Texture2D image, GamePlayer player, gamemain main)
     : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, position, image, main)
 {
     this.player = player;
     Pv = 100;
 }
예제 #4
0
파일: princess.cs 프로젝트: kylox/Templar
 public Princess(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, GamePlayer player)
     : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, speed, position, image)
 {
     bob = 0;
     count_deplacement = 60;
     canmove = 0;
     this.direction = Templar.Direction.None;
 }
 public Chargement(GamePlayer player, switch_map mapi)
 {
     this.Mapi = mapi;
     this.Player = player;
     fichier = new FileStream("Save.txt", FileMode.Open, FileAccess.Read);
     load = new BinaryReader(fichier);
     load.Close();
 }
예제 #6
0
파일: potion.cs 프로젝트: tchiiikun/Templar
 public potion(Texture2D texture, GamePlayer player, gamemain main, NPC npc, string name)
     : base(texture, player, npc.Position, main)
 {
     Main = main;
     Player = player;
     Texture = texture;
     Hitbox_potion = new Rectangle((int)Position.X, (int)Position.Y, Texture.Bounds.Width, Texture.Bounds.Y);
     Name = name;
 }
예제 #7
0
파일: Chargement.cs 프로젝트: kylox/Templar
 public Chargement(GamePlayer player, switch_map mapi, Personnage pos, gamemain main)
 {
     this.Mapi = mapi;
     this.Main = main;
     this.Player = player;
     Position = pos;
     fichier = new FileStream(@"save/Save.txt", FileMode.Open, FileAccess.Read);
     load = new BinaryReader(fichier);
 }
예제 #8
0
 public switch_map(GamePlayer Player, gamemain Main)
 {
     player = Player;
     main = Main;
     liste_map = new Texture2D[5, 5];
     liste_map[1, 2] = ressource.map_1;
     liste_map[2, 1] = ressource.map_2;
     liste_map[2, 2] = ressource.map_0;
     x = 2;
     y = 2;
     active_map = liste_map[2, 2];
 }
예제 #9
0
파일: mini_map.cs 프로젝트: kylox/Templar
        public mini_map(GamePlayer player, gamemain main)
        {
            Player = player;
            Main = main;

            Postion_red_dot.X = (Player.Position.X / 5) + Main.Fenetre.Width - 200;
            Postion_red_dot.Y = (Player.Position.Y / 5) + Main.Fenetre.Height - 100;

            fenetre = new Rectangle(Main.Fenetre.Width - 200 + 10,
                                    Main.Fenetre.Height - 100 + 10 ,
                                    Main.Fenetre.Width / 5,
                                    Main.Fenetre.Height / 5);
        }
예제 #10
0
파일: switch_map.cs 프로젝트: kylox/Templar
 public switch_map(GamePlayer Player/*, gamemain Main*/, Donjon donjon, string directori)
 {
     player = Player;
     //main = Main;
        Directorie = directori;
     listes_map = new Map[5, 5];
     for (int i = 0; i < 5; i++)
         for (int j = 0; j < 5; j++)
             listes_map[i, j] = donjon.Map[i, j];
     x = (int)donjon.map.X;
     y = (int)donjon.map.Y;
     active_map = listes_map[x, y];
        // active_map.mob = donjon.Map[x, y].mob;
        // active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
 }
예제 #11
0
파일: Coffre.cs 프로젝트: kylox/Templar
        public void Update(GamePlayer player)
        {
            if (is_open)
            {
                if (Data.keyboardState.IsKeyDown(Keys.Right) && Data.prevKeyboardState.IsKeyUp(Keys.Right))
                {
                    selection.X += 32;
                    if (selection.X > 4 * 32)
                        selection.X = 0;
                }
                if (Data.keyboardState.IsKeyDown(Keys.Left) && Data.prevKeyboardState.IsKeyUp(Keys.Left))
                {
                    selection.X -= 32;
                    if (selection.X < 0)
                        selection.X = 4 * 32;
                }
                if (Data.keyboardState.IsKeyDown(Keys.Up) && Data.prevKeyboardState.IsKeyUp(Keys.Up))
                {
                    selection.Y -= 32;
                    if (selection.Y < 0)
                        selection.Y = 4 * 32;
                }
                if (Data.keyboardState.IsKeyDown(Keys.Down) && Data.prevKeyboardState.IsKeyUp(Keys.Down))
                {
                    selection.Y += 32;
                    if (selection.Y > 4 * 32)
                        selection.Y = 0;
                }
                if (Data.keyboardState.IsKeyDown(Keys.Enter) && Data.prevKeyboardState.IsKeyUp(Keys.Enter))
                {
                    if (player.nb_item(player.inventaire) != 25 && this.tab[(int)selection.X / 32, (int)selection.Y / 32] != null)
                    {
                        for (int j = 0; j < 5; j++)
                            for (int i = 0; i < 5; i++)
                                if (player.inventaire[i, j] == null)
                                {
                                    player.inventaire[i, j] = this.tab[(int)selection.X / 32, (int)selection.Y / 32];
                                    i = 5;
                                    j = 5;
                                }

                        this.tab[(int)selection.X / 32, (int)selection.Y / 32] = null;
                    }
                }
            }
        }
예제 #12
0
파일: HUD.cs 프로젝트: kylox/Templar
        public HUD(GamePlayer Player, gamemain main)
        {
            localPlayer = Player;
            Main = main;

            //dessine les rectangle
            barre_vie = new Rectangle(100, 0, localPlayer.pv_player, 20);
            barre_endurance = new Rectangle(300, 0, localPlayer.end_player, 20);
            barre_mana = new Rectangle(500, 0, localPlayer.mana_player, 20);
            barre_experience = new Rectangle((2 * Main.Fenetre.Width / 6) - 26, Main.Fenetre.Height - 87, localPlayer.XP, 10);

            //dessine les truc qui entour les rectangles
            barre_v = new Rectangle(0, Main.Fenetre.Height - 94, 142, 34);
            barre_e = new Rectangle(0, Main.Fenetre.Height - 62, 142, 34);
            barre_m = new Rectangle(0, Main.Fenetre.Height - 30, 142, 34);
            barre_xp = new Rectangle((2 * Main.Fenetre.Width / 6) - 30, Main.Fenetre.Height - 80
                , (Main.Fenetre.Width / 5) + 150, 10);

            //dessine une mini map
            mini_map = new mini_map(localPlayer, main);
        }
예제 #13
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
        }
예제 #14
0
파일: gamemain.cs 프로젝트: kylox/Templar
 public void StartReseauConnexion()
 {
     if (Is_Server)
     {
         Serveur = new Server();
         same_map = true;
         Player2 = new GamePlayer(32, 48, 4, 8, 2, 8, 8, position_joueur, ressource.sprite_player, this, text, langue);
         while (Serveur.isrunnin)
         {
         }
     }
     if (Is_Client)
     {
         Client = new Client(IP);
         same_map = true;
         Player2 = new GamePlayer(32, 48, 4, 8, 2, 8, 8, position_joueur, ressource.sprite_player, this, text, langue);
     }
 }
예제 #15
0
파일: gamemain.cs 프로젝트: kylox/Templar
 public void AddLocalplayer()
 {
     localPlayer = new GamePlayer(32, 48, 4, 8, 2, 15, 2, position_joueur, ressource.sprite_player, this, text, langue);
     localPlayer.Niveau = 1;
 }
예제 #16
0
파일: gamemain.cs 프로젝트: kylox/Templar
 public void AddP2()
 {
     Player2 = new GamePlayer(32, 48, 4, 8, 2, 10, 8, position_joueur, ressource.sprite_player, this, text, langue);
 }
예제 #17
0
파일: NPC.cs 프로젝트: kylox/Templar
 public void touché(Direction direction, GamePlayer Player)
 {
     switch (direction)
     {
         case Direction.Left:
             if (position.X - 32 >= 0)
                 position.X += 32;
             break;
         case Direction.Right:
             if (position.X + 32 <= 25 * 32)
                 position.X -= 32;
             break;
         case Direction.Up:
             if (position.Y - 32 >= 0)
                 position.Y -= 32;
             break;
         case Direction.Down:
             if (position.Y + 32 <= 18 * 32)
                 position.Y += 32;
             break;
     }
     Pv -= Player.attaque / 3;
 }
예제 #18
0
파일: switch_map.cs 프로젝트: kylox/Templar
        public void update(GamePlayer player, gamemain main)
        {
            active_map = listes_map[x, y];
            if (player != null)
            {
                if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 4) ||
                    active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 7))
                    && x - 1 >= 0 && listes_map[x - 1, y] != null)
                {
                    x--;
                    player.Position = new Vector2(25 * 32 - 64, player.Position.Y);
                    main.List_Objet_Map.Clear();
                    main.List_Zombie.Clear();
                    main.List_Sort.Clear();
                    main.List_wall.Clear();
                    active_map = listes_map[x, y];
                    //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                    main.List_Zombie = active_map.monstre;
                }
                else
                    if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 7) ||
                active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 6))
                && y - 1 >= 0 && listes_map[x, y - 1] != null)
                    {
                        y--;
                        player.Position = new Vector2(player.Position.X, 18 * 32 - 64);
                        main.List_Objet_Map.Clear();
                        main.List_Zombie.Clear();
                        main.List_Sort.Clear();
                        main.List_wall.Clear();
                        active_map = listes_map[x, y];
                        //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                        main.List_Zombie = active_map.monstre;
                    }
                    else
                        if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 5) ||
            active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 4))
            && listes_map[x + 1, y] != null)
                        {
                            x++;
                            player.Position = new Vector2(0 + 32, player.Position.Y);
                            if (main.List_Objet_Map != null && main.List_Zombie != null && main.List_Sort != null & main.List_wall != null)
                            {
                                main.List_Objet_Map.Clear();
                                main.List_Zombie.Clear();
                                main.List_Sort.Clear();
                                main.List_wall.Clear();
                            }
                            active_map = listes_map[x, y];
                            //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                            main.List_Zombie = active_map.monstre;
                        }
                        else
                            if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 5) ||
            active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 4))
            && listes_map[x, y + 1] != null)
                            {
                                y++;
                                player.Position = new Vector2(player.Position.X, 0 + 32);
                                main.List_Objet_Map.Clear();
                                main.List_Zombie.Clear();
                                main.List_Sort.Clear();
                                main.List_wall.Clear();
                                active_map = listes_map[x, y];
                                //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                                main.List_Zombie = active_map.monstre;
                            }

            }
        }
예제 #19
0
파일: NPC.cs 프로젝트: kylox/Templar
 public NPC(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, GamePlayer player, Map map)
     : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, speed, position, image)
 {
     this.frameline = nb_frameLine;
     this.position = position;
     this.player = player;
     //partie pour L'A*
     PlayerMoved = false;
     OldPosition = player.Position;
     CanMove = true;
     direction = Direction.None;
     //Fin Partie pour l'A*
     Pv = 100;
     this.Map = map;
     Deleg = new Thread(new ThreadStart(cheminement));
     switch (frame_start)
     {
         case 1:
             Pv = 100;
             attaque = 5;
             defense = 5;
             break;
         case 4:
             Pv = 50;
             attaque = 5;
             defense = 5;
             break;
         case 7:
             attaque = 7;
             defense = 5;
             Pv = 50;
             break;
         case 10:
             attaque = 10;
             defense = 5;
             Pv = 200;
             break;
         case 16:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 19:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 22:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 25:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 28:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 31:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 34:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
     }
 }
예제 #20
0
파일: gamemain.cs 프로젝트: kylox/Templar
        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;
        }
예제 #21
0
파일: item.cs 프로젝트: tchiiikun/Templar
 public item(Texture2D texture, GamePlayer player, Vector2 position, GameScreen screen)
 {
     Texture = texture;
     Position = position;
 }
예제 #22
0
 public Caracteristique(Game game, SpriteBatch spritebatch, GamePlayer player, bool language)
     : base(game, spritebatch)
 {
     langue = language;
     Player = player;
 }