Juego En C
jarizmendi4 de Marzo de 2015
2.273 Palabras (10 Páginas)182 Visitas
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>
#include<time.h>
char usuario;
int nx=15,ny=15,m=0,X=17,Y=17,score=0,x[100],y[100],i,l,I;
int A=17,B=17;
int indiceX=0,indiceY=0;
main()
{
clrscr();
srand(time(NULL));
printf("HOLA, ESTE ES MI JUEGO HECHO EN C++" );
getch();
do{
clrscr();
//AREA//
int P;
for(P=9; P<=23; P++)
{
gotoxy(77,P);
printf("|");
gotoxy(3,23);
printf("===========================================================================" );
gotoxy(3,P);
printf("|");
gotoxy(3,8);
printf("===========================================================================" );
}
gotoxy(5,0);
printf("SCORE: %d", score);
if(nx==3)
{nx=76;}
else
{
if(nx==77)
{nx=4;}
else
{
if(ny==8)
{ny=22;}
else
{
if(ny==23)
{ny=9;}
}
}
}
//COMIDA y PUNTUACION//
/*gotoxy(30,10);
printf("A: %d",A);
printf("B: %d",B);*/
/*gotoxy(56,20);
printf("nx: %d",nx);
printf("ny: %d",ny);*/
gotoxy(A,B);
printf("@");
if(A==nx)
{
if(B==ny)
{
printf("entre a comer.");
m=m+1; score=score+10;
B=rand() %12 + 9;
A=rand() %72 + 4;}
/*gotoxy(30,15);
printf("A rand: %d",A);
printf("B rand: %d",B);*/
}
//gotoxy(56,15);
//printf("M: %d",m);
//CRECIMIENTO//
x[0]=nx;
y[0]=ny;
//X=x[0];
//Y=y[0];
usuario=getch();
if(usuario==100)
{
for(i=m-1;i>=0;i--)
{
gotoxy(nx+i,ny);
printf("X" );
}
}
else
{
if(usuario==97)
{
for(i=m-1;i>=0;i--)
{
gotoxy(nx-i,ny);
printf("X" );
...