인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

유지훈's profile image
유지훈

asked

[MMORPG Game Development Series with C# and Unity] Part 2: Data Structures and Algorithms

SideWinder maze generation algorithm

맵 오류

Written on

·

305

0

코드를 그대로 짰는데 밑 화면처럼 나오네요 random

public void make_sidewinder()

        {

            Random random = new Random();

            for (int y = 0; y < Length; y++)

            {

                int count = 1;

                for (int x = 0; x < Length; x++)

                {

                    if (x % 2 == 0 || y % 2 == 0)

                        continue;

 

                    if (random.Next(0, 2) == 0)

                    {

                        type[y , x+1] = Colortype.Empthy;

                        count++;

                    }

                    else

                    {

                        int randomindex = random.Next(0, count);

                        type[y+1 , x - randomindex*2] = Colortype.Empthy;

                        count = 1;

                    }

                }

            }

        }

C#

Answer 1

1

rookiss님의 프로필 이미지
rookiss
Instructor

강의를 보면 그 위에 코드가 더 있습니다 (길을 다 막아버리는 작업)

유지훈's profile image
유지훈

asked

Ask a question