Trabajando en el jugador
This commit is contained in:
@@ -9,8 +9,8 @@ Director::Director(std::string path)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
section.name = PROG_SECTION_GAME;
|
section.name = PROG_SECTION_TITLE;
|
||||||
section.subsection = GAME_SECTION_PLAY_1P;
|
section.subsection = TITLE_SECTION_1;
|
||||||
|
|
||||||
// Crea el objeto que controla los ficheros de recursos
|
// Crea el objeto que controla los ficheros de recursos
|
||||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "/../");
|
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "/../");
|
||||||
@@ -204,10 +204,14 @@ bool Director::setFileList()
|
|||||||
asset->add("data/gfx/title_dust.ani", t_data);
|
asset->add("data/gfx/title_dust.ani", t_data);
|
||||||
asset->add("data/gfx/title_gradient.png", t_bitmap);
|
asset->add("data/gfx/title_gradient.png", t_bitmap);
|
||||||
|
|
||||||
asset->add("data/gfx/player1_head.png", t_bitmap);
|
asset->add("data/gfx/new_player1_head.png", t_bitmap);
|
||||||
asset->add("data/gfx/player1_body.png", t_bitmap);
|
asset->add("data/gfx/new_player1_head.ani", t_data);
|
||||||
asset->add("data/gfx/player1_legs.png", t_bitmap);
|
asset->add("data/gfx/new_player1_body.png", t_bitmap);
|
||||||
asset->add("data/gfx/player1_death.png", t_bitmap);
|
asset->add("data/gfx/new_player1_body.ani", t_data);
|
||||||
|
asset->add("data/gfx/new_player1_legs.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/new_player1_legs.ani", t_data);
|
||||||
|
asset->add("data/gfx/new_player1_death.png", t_bitmap);
|
||||||
|
asset->add("data/gfx/new_player1_death.ani", t_data);
|
||||||
|
|
||||||
asset->add("data/gfx/player2_head.png", t_bitmap);
|
asset->add("data/gfx/player2_head.png", t_bitmap);
|
||||||
asset->add("data/gfx/player2_body.png", t_bitmap);
|
asset->add("data/gfx/player2_body.png", t_bitmap);
|
||||||
|
|||||||
@@ -201,8 +201,8 @@ void Title::update()
|
|||||||
case TITLE_SECTION_1:
|
case TITLE_SECTION_1:
|
||||||
{
|
{
|
||||||
// Actualiza los objetos
|
// Actualiza los objetos
|
||||||
mCoffeeBitmap->update();
|
coffeeBitmap->update();
|
||||||
mCrisisBitmap->update();
|
crisisBitmap->update();
|
||||||
|
|
||||||
// Si los objetos han llegado a su destino, cambiamos de Sección
|
// Si los objetos han llegado a su destino, cambiamos de Sección
|
||||||
if (coffeeBitmap->hasFinished() && crisisBitmap->hasFinished())
|
if (coffeeBitmap->hasFinished() && crisisBitmap->hasFinished())
|
||||||
@@ -210,12 +210,12 @@ void Title::update()
|
|||||||
section.subsection = TITLE_SECTION_2;
|
section.subsection = TITLE_SECTION_2;
|
||||||
|
|
||||||
// Pantallazo blanco
|
// Pantallazo blanco
|
||||||
SDL_SetRenderDrawColor(mRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||||
SDL_RenderClear(mRenderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_RenderPresent(mRenderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
// Reproduce el efecto sonoro
|
// Reproduce el efecto sonoro
|
||||||
JA_PlaySound(mSound);
|
JA_PlaySound(crashSound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -225,20 +225,20 @@ void Title::update()
|
|||||||
{
|
{
|
||||||
// Agita la pantalla
|
// Agita la pantalla
|
||||||
static const int v[] = {-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 0};
|
static const int v[] = {-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 0};
|
||||||
static const int a = mCoffeeBitmap->getPosX();
|
static const int a = coffeeBitmap->getPosX();
|
||||||
static const int b = mCrisisBitmap->getPosX();
|
static const int b = crisisBitmap->getPosX();
|
||||||
static int step = 0;
|
static int step = 0;
|
||||||
|
|
||||||
mCoffeeBitmap->setPosX(a + v[step / 3]);
|
coffeeBitmap->setPosX(a + v[step / 3]);
|
||||||
mCrisisBitmap->setPosX(b + v[step / 3]);
|
crisisBitmap->setPosX(b + v[step / 3]);
|
||||||
mDustBitmapR->update();
|
dustBitmapR->update();
|
||||||
mDustBitmapL->update();
|
dustBitmapL->update();
|
||||||
|
|
||||||
step++;
|
step++;
|
||||||
|
|
||||||
if (step == 33)
|
if (step == 33)
|
||||||
{
|
{
|
||||||
mSection.subsection = TITLE_SECTION_3;
|
section.subsection = TITLE_SECTION_3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -441,23 +441,23 @@ void Title::render()
|
|||||||
case TITLE_SECTION_1:
|
case TITLE_SECTION_1:
|
||||||
{
|
{
|
||||||
// Prepara para empezar a dibujar en la textura de juego
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
mScreen->start();
|
screen->start();
|
||||||
|
|
||||||
// Limpia la pantalla
|
// Limpia la pantalla
|
||||||
mScreen->clean(bgColor);
|
screen->clean(bgColor);
|
||||||
|
|
||||||
// Dibuja el tileado de fondo
|
// Dibuja el tileado de fondo
|
||||||
SDL_RenderCopy(mRenderer, mBackground, &mBackgroundWindow, nullptr);
|
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
|
||||||
|
|
||||||
// Dibuja el degradado
|
// Dibuja el degradado
|
||||||
mGradient->render();
|
gradient->render();
|
||||||
|
|
||||||
// Dibuja los objetos
|
// Dibuja los objetos
|
||||||
mCoffeeBitmap->render();
|
coffeeBitmap->render();
|
||||||
mCrisisBitmap->render();
|
crisisBitmap->render();
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
mScreen->blit();
|
screen->blit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user