Juego en c++ creado por mi
Enviado por Marcos GS • 9 de Febrero de 2016 • Trabajo • 1.464 Palabras (6 Páginas) • 305 Visitas
//Osvcar es el mas guapo del salon y gracias a el acabamos
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>
#define ARRIBA 72
#define IZQUIERDA 75
#define DERECHA 77
#define ABAJO 80
int arr[1];
int puntos[6];
int score = 0;
char tecla;
int v=5, i = -1, h = -1;
bool game_over;
bool fin = false;
int nombre [4];
using namespace std;
string name [6];
int arrs [6];
int altscore;
int aaa = 1;
int j;
char arrc [6];
void gotoxy (int x,int y){
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
SetConsoleCursorPosition(hcon,dwPos);
}
void tiempo (){
arr[5] ++;
if (arr [5] == 9){
arr [4] ++;
arr [5] = 0;
}
if (arr [4] == 7) {
arr [3] ++;
score ++;
arr [4] = 0;
arr [5] = 0;
}
if (arr [3] > 9){
arr [2]++;
arr [3] = 0;
}
if (arr [2] == 6 && arr [3] == 0){
arr [1] ++;
arr [3] = 0;
arr [2] = 0;
}
if (arr [1] > 9){
arr [0] ++;
arr [1] = 0;
}
if (arr [0] == 6 && arr [1] == 0){
game_over = true;
}
gotoxy (1,1);
cout << "Tiempo jugado: " << arr [0] << arr [1] << ":"<< arr [2] << arr [3];
gotoxy (1,2); cout << "Score: " << score;
}
void margen(){
for(int i=3;i<50;i++){
gotoxy(15,i);
printf("%c",178);
}
for(int i=3;i<50;i++){
gotoxy(50,i);
printf("%c",178);
}
}
class personage{
public:
int x,y;
personage(int _x,int _y);
void dibujar();
void controlar();
void borrar();
void vidas();
};
personage::personage(int _x,int _y){
x = _x;
y = _y;
}
void personage::dibujar(){
gotoxy(x,y);printf (" %c%c%c%c%c",30,254,254,254,30);
gotoxy(x,y+1);printf("%c%c%c%c%c%c%c",219,254,254,254,254,254,219);
gotoxy(x,y+2);printf(" %c%c%c%c%c",254,254,254,254,254);
gotoxy(x,y+3);printf(" %c%c%c%c%c",254,254,254,254,254);
gotoxy(x,y+4);printf(" %c%c%c%c%c",254,254,254,254,254);
gotoxy(x,y+5);printf("%c%c%c%c%c%c%c",219,254,254,254,254,254,219);
gotoxy(x,y+6);printf(" %c%c%c%c%c",31,254,254,254,31);
}
void personage::borrar(){
gotoxy(x,y); printf(" ");
gotoxy(x,y+1);printf(" ");
gotoxy(x,y+2);printf(" ");
gotoxy(x,y+3);printf(" ");
gotoxy(x,y+4);printf(" ");
gotoxy(x,y+5);printf(" ");
gotoxy(x,y+6);printf(" ");
}
void personage::controlar(){
if (kbhit()){
borrar();
tecla = getch() ;
if (tecla == ARRIBA and y >3)y--;
if (tecla == DERECHA && x <42 )x++;
if (tecla == ABAJO && y <43)y++;
if (tecla == IZQUIERDA && x >16)x--;
dibujar();
}
}
void personage::vidas(){
gotoxy(50,1);cout<<"vidas "<<v;
...