자유게시판

제작 영상
2012.07.13 00:07

뭐가 문제지?

조회 수 1056 추천 수 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 41184
잡담 뜬금없는 동방 프로젝트 브금 하나 투척 7 file TheEK 2012.08.07 788
제작 스샷 왕녀와기사 [아이폰] 제작현황 9 file 소프트아이스크림 2012.08.07 1442
제작 스샷 심심해서 만든 탑뷰슈팅 테스트 9 file 개촙포에버 2012.08.07 1171
막장 100점짜리 인생 1 하늘바라KSND 2012.08.07 810
막장 클래식 음악 좋아하시는 분들에게... Alkaid 2012.08.07 951
큰일났소 1 JACKY 2012.08.07 678
멘붕 3 file JACKY 2012.08.07 1341
아 .... 축구 앙대!!! 9 TheEK 2012.08.08 742
막장 역시 뭔가의 2차 창작 비스무리한 것...... 2 Alkaid 2012.08.08 566
잡담 휴가 첫날 죽어가고 있습니다... 7 아방스 2012.08.08 711
기분안조타 10 JACKY 2012.08.08 656
발표 아방스 오픈캐스트 8월호 5 file 완폐남™ 2012.08.09 788
제작 스샷 시체드랍 7 file JACKY 2012.08.10 1185
제작 스샷 영웅도 물량앞에선 장사없음 4 file JACKY 2012.08.10 1047
잡담 뭔가 골치가 아프네요 아이미르 2012.08.10 721
일본 축구 8 TheEK 2012.08.11 665
잡담 내가 만들 게임에 들어갈 로고 만들어봄 9 file 치르노 2012.08.11 923
제작 영상 오랜만에 영상 9 JACKY 2012.08.11 593
도대체 왜 아방스에서는 겜메가 이렇게 죽어있는겁니까 11 개촙포에버 2012.08.11 604
잡담 게임메이커 매력적이네요 !! 8 moopu 2012.08.12 1008
목록
Board Pagination Prev 1 ... 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 ... 755 Next
/ 755