자유게시판

제작 영상
2012.07.13 00:07

뭐가 문제지?

조회 수 1082 추천 수 0 댓글 7

        public class MAP : Database
        {
            public List<NPC> Npcs = new List<NPC>();

            static int MapID;

            static int Width;
            static int Height;

            static int[] Data = null;

            int XY;
           
            public int OnlineUsers = 0;

            public MAP(int map)
            {
                MySqlDataReader mdr = MySqlHelper.ExecuteReader(Connection, "SELECT * FROM npc WHERE map = '" + map + "';");

                int r = 0;

                while (true)
                {
                    if (!mdr.Read()) break;

                    NPC i = new NPC();

                    i.No = mdr.GetInt32("no");
                    i.Type = mdr.GetInt16("type");

                    i.Move = mdr.GetInt16("move") == 1 ? true : false;

                    i.Id = mdr.GetString("name");

                    i.Hp = mdr.GetInt32("hp");

                    i.Regen = mdr.GetInt32("rebirth");
                    i.Pure_Regen = i.Regen;

                    i.Handling = mdr.GetInt16("handling");
                    i.Time = i.Handling;

                    i.Damage = mdr.GetInt32("power");
                    i.Defense = mdr.GetInt32("defensive");

                    i.Map = mdr.GetInt16("map");
                    i.X = mdr.GetInt16("x");
                    i.Y = mdr.GetInt16("y");
                    i.D = mdr.GetInt16("d");

                    i.Image = mdr.GetString("image");

                    //i.Function = mdr.GetString("function");

                    i.rand = new Random(r);

                    Npcs.Add(i);
                    r++;
                }
                mdr.Close();

                string Name;

                if (map < 10) Name = "BMap00" + map;
                else if (map >= 10 && map < 100) Name = "BMap0" + map;
                else Name = "BMap" + map;

                if (File.Exists("./BMap/" + Name + ".map"))
                {
                    using (StreamReader outfile = File.OpenText("./BMap/" + Name + ".map"))
                    {
                        string read = outfile.ReadToEnd();
                        string[] result = Regex.Split(read, "\001");

                        MapID = int.Parse(result[3]);

                        Width = int.Parse(result[5]);
                        Height = int.Parse(result[6]);

                        while (0 <= Height - 1)
                        {
                            while (0 <= Width - 1)
                            {
                                Data[XY] = Data[7 + XY];
                                ++XY;
                            }
                        }

                        outfile.Close();
                    }
                }
            }

            static bool Valid(int x, int y)
            {
                return (x >= 0 && x < Width && y >= 0 && y < Height);
            }

            public static bool Passable(int x, int y)
            {
                if (!Valid(x, y)) return false;

                foreach (USER user in Handler.User.Values)
                    if (MapID == user.map && x == user.x && y == user.y) return false;

                foreach (MAP i in Handler.Map.Values)
                {
                    foreach (NPC npc in i.Npcs)
                        if (!npc.Die && MapID == npc.Map && x == npc.X && y == npc.Y) return false;
                }

                if (Data[x + (y * Width)] == 0) return false;

                return true;
            }

 

 

 

 

 

 

 

 

왜 오류가 뜨는 것이야

Who's Mania

?

2001년부터 쯔꾸르 RPG를 만진 사람.

게임 공작소, 창조도시 그 마니아. 맞습니다.

Comment '7'
  • ?
    Mania 2012.07.13 00:08
    정규식이면 \001 이 맞을텐디 ㅡㅡ
  • profile
    JACKY 2012.07.13 00:11
    저도 잘 모르겠습니다 고갱님
  • ?
    Mania 2012.07.13 01:09
    string[] result = Regex.Split(read, Convert.ToChar(1).ToString());

    저렇게 고쳐주어서 끝났고.

    Data = new int[Width * Height + 1];

    for (int i = 0; i<Height; i++)
    {
    for (int j = 0; j < Width; j++)
    {
    Data[XY] = int.Parse(result[6 + XY]);
    ++XY;
    }
    }
  • ?
    Mania 2012.07.13 01:10
    ㅇㅇ 잘된다 야호 하하하하ㅏ하하하

    게임 로직 ㅡㅡ 개나쁜것
  • profile
    JACKY 2012.07.13 10:39
    그나저나 이건 XNA 임요?
  • ?
    Mania 2012.07.13 18:49
    닷넷이라우. ㅇㅇ
  • profile
    하늘바라KSND 2012.07.14 07:08
    외계어!

List of Articles
분류 제목 글쓴이 날짜 조회 수
공지 아방스 게시물 · 댓글 작성 규칙 (최근 수정일 2015.11.25) 17 file 완폐남™ 2012.07.17 47346
잡담 오 구글크롬 빠르다 9 질풍처럼 2011.03.26 770
잡담 게임에 있어서 가장 중요한 것 13 시트르산 2011.05.13 770
아아 … 어떻하죠 VX? ACE? 6 DevilEx 2012.06.04 770
잡담 나 티스토리 시작함!!!!! 7 조석진 2013.05.22 770
제작 스샷 느어어어어어어 8 file JACKY 2013.04.24 770
잡담 완성작 게임 나오는게 별로 없는 한탄 9 2013.08.28 770
제작 일지 제가 만든 어플이 검토성공이 됬어요~! 3 레몬 2014.02.10 770
잡담 프린세스 메이커가 드디어 신작이 출시되네요 11 file 부초 2014.05.03 770
잡담 목욕하면서 컴퓨터하는방법없습니까? 11 HeyCat 2010.01.20 771
2k로만든 무기별 공략(?)또는 특징 Assault Meteoric Star 2010.08.21 771
잡담 po좀비肉파티wer 5 JACKY 2010.08.29 771
컴퓨터 고장남 3 슈팅스타* 2011.11.24 771
설문 [설문]메탈 페이블 [길더라도 꼭 참여해주세요] 13 JACKY 2012.12.18 771
동국대학교 입학사정관 최종합격 6 JACKY 2012.10.26 771
제작 스샷 이거 뭐하는 걸로 보이나요? 9 file 마리모 2013.10.20 771
잡담 빈 수레가 요란하다 라는 말이 있습니다. 2013.06.05 771
팀장 연락 두절 3주째;; 21 file 오월의눈사람 2013.07.14 771
잡담 우왕 요즘은 ㅋㅋㅋㅋ (투표) 6 작은악마 2008.07.21 772
잡담 학교에 신종 11명.. 2 칼리아 2009.10.24 772
잡담 캐릭터 메이커...... 5 えらい☆初音ミク 2010.01.16 772
목록
Board Pagination Prev 1 ... 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 ... 756 Next
/ 756