Game instructions :

W key The plane moved up
S key The plane moved down
A key The plane moved to the left
D key The plane moved to the right
Space bar The plane fired shells
#include <stdio.h> #include <stdlib.h> #include <conio.h>
// General input output library , Mainly the input and output of files and standard console #include <windows.h>// Contains the Sleep() Functions, etc void
hide_cursor(void){ CONSOLE_CURSOR_INFO info={1,0}; SetConsoleCursorInfo(
GetStdHandle(STD_OUTPUT_HANDLE),&info); } int main(void){ int x=5; int y=10; int
i,j; int is_fire=0;// Launch or not int nx=y/2;// Target position int is_killed=0;// Was it killed srand(time(
NULL));// Generating random number seeds hide_cursor();// hide cursor system("mode con cols=60 lines=40");
// Set screen to phone format while(1){ system("cls"); if(is_killed==0){// They didn't get killed , Draw the target for(i=0;i<nx;
i++) printf(" "); printf("@\n"); } if(is_fire==0){ for(i=0;i<y;i++) printf("\n")
; }else{ for(i=0;i<y;i++){ for(j=0;j<x;j++) printf(" "); printf(" |\n"); is_fire
=0; } if(nx==x+2) is_killed=1; } // Drawing airplanes for(i=0;i<x;i++) printf(" "); printf("
*\n"); for(i=0;i<x;i++) printf(" "); printf("*****\n"); for(i=0;i<x;i++) printf(
" "); printf(" * *\n"); if( kbhit() ){ // If a keyboard key is detected , return 1 int c= getch();
// Get keyboard value , There is no need to press enter switch(c){ case 'a':x--;break; case 'd':x++;break; case 's':y++;
break; case 'w':y--;break; case ' ':is_fire=1;break; } } Sleep(200); // retention 200 millisecond
Output with pause } }

Technology
Daily Recommendation