I ask about some examples codes to add to my source code to make the game better . #include#include#include#include#include#define MAXWIDTH 10#define MAXHIGHT 10 void sleep(clock_t duree){ clock_t...

I ask about some examples codes to add to my source code to make the game better .
#include#include#include#include#include#define MAXWIDTH 10#define MAXHIGHT 10
void sleep(clock_t duree){ clock_t time_out = clock(); while((time_out + duree) > clock());}
main(){ int i,j; int xg=0, yg=0, LifeIndex=100; // Random generation of targer positions srand(time(NULL)); int xb = 1 + rand()%MAXWIDTH; int yb = 1 + rand()%MAXHIGHT; float NewDistance, OldDistance=0; do{ NewDistance=sqrt(((xg-xb)*(xg-xb))+((yg-yb)*(yg-yb))); printf("life index : %d %%\n",LifeIndex); for(i=0;i// Print the gamer at (Xg, Yg) position for(i=1;i<=yg;i++){ printf("\n");="" }="" for(j=""><=xg;j++){ printf("\t");="" }="" print="" gamer="" icon="" char="" gamer="1;" ascii="" code="" of="" the="" gamer="" printf("%c",gamer);="" read="" a="" char="" from="" the="" keyboard.="" the="" function="" is="" defined="" in="" conio.h="" char="" move="getch();" motion="" with="" g="" (gauche)="" and="" d="" stands="" for="" (droite)...="" if((move="='g'||move=='G')&&(xg">0)){ xg--; LifeIndex--; }else if((move=='d'||move=='D')&&(xg0)){ yg--; LifeIndex--; }else if((move=='b'||move=='B')&&(ygif(xg==xb&&yg==yb&&LifeIndex>=0){ printf("YOU WON !!!"); }else{ printf("GAME OVER !!!"); }
}

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here