갤러그를 만들고있습니다. 도와주세요 ㅠ
ComeOn
질문 요약 :학교 과제로 갤러그를 만들고있습니다.조금 도와주세요 아직 모르는게 많아서 시작하는것만해도 시간을 많이 잡아먹엇습니다.
그러다보니 3이후발표날이네요 ㅜㅜ
사이트에있는 인베이더 강좌가 많이 도움이됬지만,, 저로서는 아직 시간도 없고 급하게 배우려고하다보니 이해하는것도 힘든거 같습니다.
우선 제가 지금 질문하는 내용은
1. 슬립이나 딜레이를 넣다보니 내 미사일이나갈때 등 제케릭터가 움직이지않습니다.. 같이할수잇는법
2. 적비행기를 랜덤으로 출현시켜 y 축으로 정해준 시간에따라 일정하게 내려오는것.
3. 적비행기가 출현하면서 미사일을 일정 시간마다 발사하는것
*제가 태스트로 만들어본거에요 수정할점이나 추가할점 갈켜주시길.. 제발 ㅠㅠ
#include stdafx.h
#include time.h
#include windows.h
#include conio.h
#define left 75 // 키보드 코드
#define right 77
#define space 32
void gotox(int x);
void delay(clock_t n)
{
clock_t start = clock();
while(clock() - start n);
}
void gotoxy(int x, int y)
{
coord xy={x,y};
setconsolecursorposition(getstdhandle(std_output_handle),xy); //출력장치의 핸들을 가져와서 그곳에 사용하는 커서의 위치를 x로
}
void shoot(int s)
{
coord s={s};
setconsolecursorposition(getstdhandle(std_output_handle),s);
}
void main()
{
int x=12;// 처음 시작할 x 축의 좌표
int y=20;
char m;
int missile_x,missile_y;
int missile_num=5;
int other_ap,othrt_y=2;
srand((int)time(0));
printf(sda);
gotoxy(x,y);//커서를 x 위치로
printf(a);// 비행기모형
while(1){// 무한루트
m=getch();
if(m== right) { gotoxy(x,y); printf( ); x++; gotoxy(x,y); printf(a);}// 오른쪽으로 이동
if(m== left) { gotoxy(x,y); printf( ); x--; gotoxy(x,y);printf(a);}// 왼쪽으로 이동
if(m== space){missile_x= x; missile_y =y-2; while(missile_y !=1){gotoxy(missile_x, missile_y);
printf(^);gotoxy(missile_x, missile_y+1);
printf( );delay(20);missile_y--;
}
}
other_ap = rand() % 10;
if(othrt_y!=18){
gotoxy(other_ap,othrt_y); printf(d);
othrt_y++;
gotoxy(other_ap,othrt_y-1); printf( );
delay(80);
}
}
}