PlayXP

새로운 사이트를 준비하는 동안
여러분의 이야기가 이어질 작은 공간을 마련했습니다.

PlayXP 서비스를 준비하며 함께 작업하고 있는 운영진 일러스트

뱀게임 점수가 안올라가는 문제(일부)

조회 수 559

for (int j = 1; j <=2; j++)

   {

      if(j==1)

      item->type = FOOD;//#define FOOD ;#define TRAP 위에있음 ;

   else

      item->type = TRAP;

      for (i = 0; i < food; i++)

      {

         item->position.y = rand() % 18 + 2;

         item->position.x = rand() % 76 + 2;

      

         GotoXY(item->position.x , item->position.y);

         if (item->type == FOOD)

            putchar('$');

          if (item->type == TRAP)

            putchar('#');

         }

   }// 덫이랑 음식만들기 소스(정상적이게됨)

 

 

for (i = 0; i < food; i++)

            {

item->type = FOOD;

if(item ->type == FOOD){

               if (snake->position[0].x == item->position.x && snake->position[0].y == item->position.y)

               {

                  score++;

                  sum++;

                  InitScreen(score, first);//점수 반환함수 first 가 1이면 다음라운드로감

                  if (sum == food)

                  {

                     sum = 0;

                     stage++;//전역변수

                     first = 1;

                     InitScreen(score, first);//다음 단계이동

                  }//라운드 클리어

               }}

item->type = TRAP;

if(item ->type == TRAP){

               if(snake->position[0].x == item->position.x && snake->position[0].y == item->position.y)

               {

                  if (item->type == TRAP)

                  {

                    

                     Sleep(1000);

                     return 0;

                  }//TRAP 밞음

               }}

               

            }

일부만 가져왔습니다... 저기에 score 가 안올라가는데 왜그런가요 ... 뱀이  $를 인식못하는것같습니다..

type 에 food 도 넣어줫는데말이죠....​ 왜이런건가요? 

목록으로

댓글

댓글을 불러오는 중...