#pragma once
#ifndef JUEGO
#define JUEGO
/*
inlcude
*/
#include "recursos.h"
#include "miJuego2.h"
#include "VariablesEntorno.h"
using namespace Recursos;
using namespace variablesEntorno;
using namespace funcionesJuego;
// loop
namespace juego {
void Inicializar() {
}
void CargarRecursos(Sprite& enemigo, Sprite& jugador, string v[28], char
escenario[28][120]) {
funcionesJuego::Nivel1(v);
funcionesJuego::ConvertiraMatriz(v, escenario, jugador, enemigo);
int a = 0;
}
bool Actualizar(char escenario[28][120]) {
bool salir = false;
int tecla = 0;
tecla = leerTecla();
if (tecla != 0) {
if (tecla == 27) {
//controla la salida
salir = true;
}
if (tecla == 97) MoverJugador(jugador, -1, 0, escenario); //a
if (tecla == 100) MoverJugador(jugador, 1, 0, escenario); //d
if (tecla == 119) MoverJugador(jugador, 0, -1, escenario); //w
if (tecla == 115) MoverJugador(jugador, 0, 1, escenario); //s
if (tecla == 75) MoverJugador(jugador, -1, 0, escenario);
//Izquierda
if (tecla == 77) MoverJugador(jugador, 1, 0, escenario);
//derecha
if (tecla == 72) MoverJugador(jugador, 0, -1, escenario);
//arriba
if (tecla == 80) MoverJugador(jugador, 0, 1, escenario); //abajo
salir = MIJUEGO::Administrador(escenario, jugador, barraEnergia,
enemigo);
return salir;
}
void Dibujar(char escenario[28][120], Sprite jugador, Sprite enemigo) {
CambiarCursor(false);
DibujarObjetos(jugador, enemigo);
//Tablero
PosicionarXY(100, 0);
CambiarColor(3);
printf("Vidas : %d", variablesEntorno::vidas);
}
void DescargarRecursos() {}
void Terminar() {}
void Jugar() {
/*
* programar nuestro loop
*/
string v[28];
char escenario[28][120];
variablesEntorno::jugador.X = 10;
variablesEntorno::jugador.Y = 10;
variablesEntorno::[Link] = 64;
variablesEntorno::[Link] = 1;
variablesEntorno::enemigo.X = 10;
variablesEntorno::enemigo.Y = 10;
variablesEntorno::[Link] = 64;
variablesEntorno::[Link] = 1;
variablesEntorno::barraEnergia.X = 27;
variablesEntorno::barraEnergia.Y = 4;
variablesEntorno::[Link] = 219;
Inicializar();
CargarRecursos(enemigo, jugador, v, escenario);
bool salir = false;
funcionesJuego::DibujarEscenario(escenario);
do {
Dibujar(escenario, jugador, enemigo);
salir = Actualizar(escenario);
variablesEntorno::contadorCiclo += 1;
} while (!salir);
DescargarRecursos();
Terminar();
}
}
#endif // !"GAME"