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