Professional Documents
Culture Documents
Prueba 1
Prueba 1
h"
#include <iostream>
#include "conio.h"
int mapa[FILAS][COLUMNAS] = {
//imprime la matriz
for (int f = 0; f < FILAS; f++) {
if (mapa[f][c] == 0) Console::ForegroundColor =
ConsoleColor::White;
if (mapa[f][c] == 1) Console::ForegroundColor =
ConsoleColor::Red;
if (mapa[f][c] == 3) Console::ForegroundColor =
ConsoleColor::DarkCyan;
if (mapa[f][c] == 4) Console::ForegroundColor =
ConsoleColor::DarkYellow;
if (mapa[f][c] == 6) Console::ForegroundColor =
ConsoleColor::Yellow;
}
cout << endl;
}
}
void borrar_perro(int x, int y)
{
const int FILAS = 6;
const int COLUMNAS = 12;
int mapa[FILAS][COLUMNAS] = {
//imprime la matriz
for (int f = 0; f < FILAS; f++) {
Console::ForegroundColor = ConsoleColor::White;
int main()
{
ventana(180, 60);
int x = 0, y = 0;
mapa_1();
//perro();
perro(x, y);
while (1)
{
if (_kbhit())
{
//borrar
borrar_perro(x, y);
//mover
char tecla = _getch();
if (tecla == 'd'|| tecla == 'D') x++;
if (tecla == 'a' || tecla == 'A') x--;
if (tecla == 'w' || tecla == 'W') y--;
if (tecla == 's' || tecla == 'S') y++;
//dibujar
perro(x, y);
system("pause>0");
return 0;
}