Proyecto X-Soldiers V1 Mayo 2011
src/include/jugador.h
Go to the documentation of this file.
00001 
00010 #ifndef _JUGADOR_H_
00011 #define _JUGADOR_H_
00012 
00013 //includes
00014 #include <ctime>
00015 #include "constantes.h"
00016 #include "arma.h"
00017 
00025 class Jugador{
00026 
00027         private:
00028                 
00031                 int vida_;
00032 
00035                 int velocidad_;
00036         
00039                 int posX_,posY_;
00040 
00041 
00044                 Arma* arma_;
00045 
00048                 int estado_;
00049 
00050                 //este estado lo manejamos con enteros, predefinidos en un pdf adjunto al juego; nos sirve para controlar el estado y simular el movimiento
00051 
00052 
00055                 clock_t ai,af;  //Para el control del movimiento.
00056 
00057         public:
00058 
00065                 Jugador(int px, int py):posX_(px),posY_(py){
00066                         vida_=VIDA;     //VIDA es una constante definida para el valor de la vida del jugador.
00067                         velocidad_=VELOCIDAD;   //VELOCIDAD es una constante definida para el valor base de la velocidad del jugador.
00068                         estado_=7;
00069                         ai=clock(); //relojes para el control del power-up, de momento NO operativos.
00070                         af=clock();
00071                 }
00072 
00073 
00078                 int Vida() const{ 
00079                         return vida_; 
00080                 }
00081 
00086                 int Velocidad() const{ 
00087                         return velocidad_; 
00088                 }
00089 
00095                 int PosicionX() const{
00096                         return posX_;
00097                 }
00098 
00104                 int PosicionY() const{
00105                         return posY_;
00106                 }
00107 
00113                 Arma* ArmaActual() const{
00114                         return arma_;
00115                 }
00116 
00121                 void Vida(int vida){ 
00122                         vida_-=vida; 
00123                 }
00124 
00129                 void Velocidad(int v){ 
00130                         velocidad_+=v; 
00131                 }
00132 
00138                 void PosicionX(int posx){
00139                         posX_=posx;
00140                 }
00141 
00147                 void PosicionY(int posy){
00148                         posY_=posy;
00149                 }
00150 
00156                 int estado()const{
00157                         return estado_;
00158                 }
00159 
00165                 void estado(int e){
00166                         estado_=e;
00167                 }
00168 
00174                 clock_t tiempoi()const{
00175                         return ai;
00176                 }
00177                 
00183                 clock_t tiempof()const{
00184                         return af;
00185                 }
00186 
00192                 double tiempo()const{
00193                         return difftime(af,ai);
00194                 }
00195 
00200                 void tiempoim(){
00201                         ai=clock();
00202                 }
00203 
00208                 void tiempofm(){
00209                         af=clock();
00210                 }
00211         
00212 };
00213 #endif
00214