자유게시판

제작 영상
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 40552
제작 영상 보스전은 전투시간 조절하기가 힘드네요. 2 스리아씨 2013.12.08 800
제작 영상 보스러쉬 모드를 만들거에요. 1 file 뱀신의교주 2014.06.04 663
제작 영상 백만년의 반투명 이무기 소식 하늘바라KSND 2015.03.30 103
제작 영상 방금만들기 시작한 음악 1분 녹음 6 조석진 2012.09.17 742
제작 영상 발컨 제작자를 둔 게임아! 미안하다!!!!! 3 뱀신의교주 2014.07.20 815
제작 영상 반투명 이무기 피니엔진판과 네코노벨판 비교영상 1 하늘바라KSND 2015.01.29 113
제작 영상 반투명 이무기 개발 일지 2015.04.23 6 file 하늘바라KSND 2015.04.24 233
제작 영상 바실리어트로 만들어 보았다. 4 하늘바라KSND 2012.12.21 1301
제작 영상 미니맨 2 테스트 150410 2 DD-Tokki 2015.04.10 102
제작 영상 미니게임을 또 하나 만들어봤습니다. 9 뱀신의교주 2014.05.14 821
제작 영상 뭐가 문제지? 7 Mania 2012.07.13 1056
제작 영상 무한 ☆ 노가다 4 JACKY 2012.07.19 770
제작 영상 무천0.3v 13 칸타모 2012.08.14 825
제작 영상 무려 새로운 추가 캐릭터 떡밥 ㄷㄷ 2 인생의먹구름 2010.08.08 644
제작 영상 모바일 2D, MMORPG 미스 레시아 카쉬냅 2019.03.26 79
제작 영상 몇몇 게임에서 등장하는 보스 패턴 7 미루 2012.11.21 1598
제작 영상 며칠동안 스크립트 붙들고 한 일 1 Omegaroid 2013.10.12 785
제작 영상 메페의 처음 부작 기획 5 JACKY 2010.08.21 711
제작 영상 메페에 덤벼라 이것들아 3 JACKY 2010.09.04 550
제작 영상 메페[막장?!]시스템계획 4 JACKY 2011.08.07 956
목록
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Next
/ 19