슈팅게임인데...제가지금한게 30%~50%정도밖에완성이안된..더이상진행이잘안되네요. 총알을 연속적으로 발사할수있게랑 적비행기를 만들어 주시면 감사하겠습니다...스페이스가 총알발사에요..
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
char bg[25][80];
void PrintfScreen(void);
void ClearScreen(void);
void GameMain(void);
void KeyControl(void);
void BulletDraw(void);
void PlayerDraw(void);
int playerY, playerX, fire=0;
int bulletX,bulletY;
void main(void)
{
for(;;)
{
ClearScreen();
GameMain();
PrintfScreen();
}
}
void PrintfScreen(void)
{
bg[24][79]=0;
printf("%s",bg);
}
void ClearScreen(void)
{
int x,y;
system("cls");
for (y=0; y<25; y++)
{
for (x=0; x<80; x++)
{
bg[y][x]=' ';
}
}
}
void GameMain(void)
{
KeyControl();
BulletDraw();
PlayerDraw();
}
void KeyControl(void)
{
char pressKey;
if(kbhit())
{
pressKey=getch();
switch(pressKey)
{
case 72: playerY--;
if(playerY<1)
playerY=1;
break;
case 75 : playerX--;
if(playerX<1)
playerX=1;
break;
case 77: playerX++;
if(playerX>75)
playerX=75;
break;
case 80: playerY++;
if(playerY>23)
playerY=23;
break;
case 32: if(fire ==0)
{
fire = 1;
bulletX = playerX+5;
bulletY=playerY;
}
break;
}
}
}
void BulletDraw(void)
{
if(fire!=1)
{
return;
}
bg[bulletY][bulletX-1]='-';
bg[bulletY][bulletX+0]='>';
bulletX++;
if(bulletX>79)
{
fire=0;
}
}
void PlayerDraw(void)
{
bg[playerY-1][playerX+0]='-';
bg[playerY-1][playerX+1]='>';
bg[playerY+0][playerX+1]='>';
bg[playerY+0][playerX+2]='>';
bg[playerY+0][playerX+3]='>';
bg[playerY+1][playerX+0]='-';
bg[playerY+1][playerX+1]='>';
}
부탁드립니다....