Compare commits
7 Commits
88041eba23
...
v2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| f83154c062 | |||
| 9e73f7f97d | |||
| 742ca02573 | |||
| d77757853d | |||
| ca7ae7418e | |||
| f880bb7d74 | |||
| 9784b5517a |
2
Makefile
@@ -6,7 +6,7 @@ windows:
|
||||
g++ -std=c++11 -Wall -O2 source/*.cpp -lmingw32 -lSDL2main -lSDL2 -o bin/$(executable).exe
|
||||
macos:
|
||||
mkdir -p bin
|
||||
g++ -std=c++11 -Wall -O2 -lSDL2 source/*.cpp -o bin/$(executable)_macos
|
||||
g++ source/*.cpp -std=c++11 -Wall -O2 -lSDL2 -o bin/$(executable)_macos
|
||||
linux:
|
||||
mkdir -p bin
|
||||
g++ source/*.cpp -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux
|
||||
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
data/gfx/menu_game_over_end.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
data/gfx/player_arounder_fire.png
Normal file
|
After Width: | Height: | Size: 887 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
data/gfx/player_bal1_fire.png
Normal file
|
After Width: | Height: | Size: 835 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -43,6 +43,8 @@ loop=0
|
||||
frames=20,21,22,23
|
||||
[/animation]
|
||||
|
||||
|
||||
|
||||
[animation]
|
||||
name=sideshoot
|
||||
speed=5
|
||||
@@ -83,4 +85,92 @@ name=centershoot_2C
|
||||
speed=5
|
||||
loop=0
|
||||
frames=44,45,46,47
|
||||
[/animation]
|
||||
|
||||
|
||||
|
||||
[animation]
|
||||
name=walk_pwr
|
||||
speed=3
|
||||
loop=0
|
||||
frames=0,1,2,3
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=stand_pwr
|
||||
speed=5
|
||||
loop=0
|
||||
frames=4,5,6,7
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=walk_1C_pwr
|
||||
speed=3
|
||||
loop=0
|
||||
frames=8,9,10,11
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=stand_1C_pwr
|
||||
speed=5
|
||||
loop=0
|
||||
frames=12,13,14,15
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=walk_2C_pwr
|
||||
speed=3
|
||||
loop=0
|
||||
frames=16,17,18,19
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=stand_2C_pwr
|
||||
speed=5
|
||||
loop=0
|
||||
frames=20,21,22,23
|
||||
[/animation]
|
||||
|
||||
|
||||
|
||||
[animation]
|
||||
name=sideshoot_pwr
|
||||
speed=2
|
||||
loop=0
|
||||
frames=24,25,26,27
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot_pwr
|
||||
speed=2
|
||||
loop=0
|
||||
frames=28,29,30,31
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=sideshoot_1C_pwr
|
||||
speed=2
|
||||
loop=0
|
||||
frames=32,33,34,35
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot_1C_pwr
|
||||
speed=2
|
||||
loop=0
|
||||
frames=36,37,38,39
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=sideshoot_2C_pwr
|
||||
speed=2
|
||||
loop=0
|
||||
frames=40,41,42,43
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot_2C_pwr
|
||||
speed=2
|
||||
loop=0
|
||||
frames=44,45,46,47
|
||||
[/animation]
|
||||
9
data/gfx/player_fire.ani
Normal file
@@ -0,0 +1,9 @@
|
||||
frameWidth=28
|
||||
frameHeight=32
|
||||
|
||||
[animation]
|
||||
name=default
|
||||
speed=5
|
||||
loop=0
|
||||
frames=0,1,2,3
|
||||
[/animation]
|
||||
@@ -61,54 +61,54 @@ frames=28,29,30,31
|
||||
name=sideshoot
|
||||
speed=5
|
||||
loop=0
|
||||
frames=32,33,34,35
|
||||
frames=16,17,18,19
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot
|
||||
speed=5
|
||||
loop=0
|
||||
frames=36,37,38,39
|
||||
frames=20,21,22,23
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=sideshoot_1C
|
||||
speed=5
|
||||
loop=0
|
||||
frames=40,41,42,43
|
||||
frames=24,25,26,27
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot_1C
|
||||
speed=5
|
||||
loop=0
|
||||
frames=44,45,46,47
|
||||
frames=28,29,30,31
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=sideshoot_pwr
|
||||
speed=5
|
||||
speed=2
|
||||
loop=0
|
||||
frames=48,49,50,51
|
||||
frames=16,17,18,19
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot_pwr
|
||||
speed=5
|
||||
speed=2
|
||||
loop=0
|
||||
frames=52,53,54,55
|
||||
frames=20,21,22,23
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=sideshoot_1C_pwr
|
||||
speed=5
|
||||
speed=2
|
||||
loop=0
|
||||
frames=56,57,58,59
|
||||
frames=24,25,26,27
|
||||
[/animation]
|
||||
|
||||
[animation]
|
||||
name=centershoot_1C_pwr
|
||||
speed=5
|
||||
speed=2
|
||||
loop=0
|
||||
frames=60,61,62,63
|
||||
frames=28,29,30,31
|
||||
[/animation]
|
||||
@@ -115,14 +115,14 @@ D E M O
|
||||
## 38 - TEXTOS DEL JUEGO
|
||||
fases mes!
|
||||
|
||||
## 39 -
|
||||
-
|
||||
## 39 - MENU SELECCION DE JUGADOR
|
||||
Selecciona personatge
|
||||
|
||||
## 40 -
|
||||
-
|
||||
## 40 - MENU SELECCION DE JUGADOR
|
||||
Enrere
|
||||
|
||||
## 41 -
|
||||
-
|
||||
## 41 - MENU DE PAUSA
|
||||
Menu de pausa
|
||||
|
||||
## 42 -
|
||||
-
|
||||
|
||||
@@ -115,14 +115,14 @@ D E M O
|
||||
## 38 - TEXTOS DEL JUEGO
|
||||
stages left!
|
||||
|
||||
## 39 -
|
||||
-
|
||||
## 39 - MENU SELECCION DE JUGADOR
|
||||
Select Player
|
||||
|
||||
## 40 -
|
||||
-
|
||||
## 40 - MENU SELECCION DE JUGADOR
|
||||
Back
|
||||
|
||||
## 41 -
|
||||
-
|
||||
## 41 - MENU DE PAUSA
|
||||
Pause Menu
|
||||
|
||||
## 42 -
|
||||
-
|
||||
|
||||
@@ -115,14 +115,14 @@ D E M O
|
||||
## 38 - TEXTOS DEL JUEGO
|
||||
fases mas!
|
||||
|
||||
## 39 -
|
||||
-
|
||||
## 39 - MENU SELECCION DE JUGADOR
|
||||
Selecciona jugador
|
||||
|
||||
## 40 -
|
||||
-
|
||||
## 40 - MENU SELECCION DE JUGADOR
|
||||
Volver
|
||||
|
||||
## 41 -
|
||||
-
|
||||
## 41 - MENU DE PAUSA
|
||||
Menu de pausa
|
||||
|
||||
## 42 -
|
||||
-
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
font_png=smb2.png
|
||||
font_txt=smb2.txt
|
||||
|
||||
sound_cancel=menu_cancel.wav
|
||||
sound_accept=menu_select.wav
|
||||
sound_move=menu_move.wav
|
||||
sound_accept=menu_select.wav
|
||||
|
||||
name=GAME OVER
|
||||
x=0
|
||||
y=96
|
||||
y=120
|
||||
backgroundType=0
|
||||
backgroundColor=0,0,0,255
|
||||
backgroundColor=128,64,0,0
|
||||
|
||||
areElementsCenteredOnX=true
|
||||
isCenteredOnX=true
|
||||
centerX=199
|
||||
|
||||
selector_color=84,110,122,0
|
||||
selector_text_color=255,122,0
|
||||
selector_color=255,122,0,255
|
||||
selector_text_color=255,255,235
|
||||
|
||||
defaultActionWhenCancel=1
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
font_png=smb2.png
|
||||
font_txt=smb2.txt
|
||||
|
||||
sound_cancel=menu_cancel.wav
|
||||
sound_accept=menu_select.wav
|
||||
sound_move=menu_move.wav
|
||||
sound_accept=menu_select.wav
|
||||
|
||||
name=OPTIONS
|
||||
x=0
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
font_png=smb2.png
|
||||
font_txt=smb2.txt
|
||||
|
||||
sound_cancel=menu_cancel.wav
|
||||
sound_accept=menu_select.wav
|
||||
sound_move=menu_move.wav
|
||||
sound_accept=menu_select.wav
|
||||
|
||||
name=PAUSE
|
||||
x=0
|
||||
y=96
|
||||
y=80
|
||||
backgroundType=1
|
||||
backgroundColor=41,57,65,240
|
||||
|
||||
@@ -18,7 +17,13 @@ centerX=128
|
||||
selector_color=255,122,0,255
|
||||
selector_text_color=255,255,255
|
||||
|
||||
defaultActionWhenCancel=0
|
||||
defaultActionWhenCancel=1
|
||||
|
||||
[item]
|
||||
text=PAUSE MENU
|
||||
hPaddingDown=7
|
||||
selectable=false
|
||||
[/item]
|
||||
|
||||
[item]
|
||||
text=CONTINUE
|
||||
|
||||
40
data/menu/player_select.men
Normal file
@@ -0,0 +1,40 @@
|
||||
font_png=smb2.png
|
||||
font_txt=smb2.txt
|
||||
|
||||
sound_move=menu_move.wav
|
||||
sound_accept=menu_select.wav
|
||||
|
||||
name=PLAYER_SELECT
|
||||
x=0
|
||||
y=116
|
||||
backgroundType=0
|
||||
backgroundColor=48,48,64,192
|
||||
|
||||
areElementsCenteredOnX=true
|
||||
isCenteredOnX=true
|
||||
centerX=128
|
||||
|
||||
selector_color=229,28,35,0
|
||||
selector_text_color=255,180,0
|
||||
|
||||
defaultActionWhenCancel=3
|
||||
|
||||
[item]
|
||||
text=SELECT PLAYER
|
||||
hPaddingDown=7
|
||||
selectable=false
|
||||
[/item]
|
||||
|
||||
[item]
|
||||
text=BAL1
|
||||
hPaddingDown=2
|
||||
[/item]
|
||||
|
||||
[item]
|
||||
text=AROUNDER
|
||||
hPaddingDown=7
|
||||
[/item]
|
||||
|
||||
[item]
|
||||
text=BACK
|
||||
[/item]
|
||||
@@ -1,9 +1,8 @@
|
||||
font_png=smb2.png
|
||||
font_txt=smb2.txt
|
||||
|
||||
sound_cancel=menu_cancel.wav
|
||||
sound_accept=menu_select.wav
|
||||
sound_move=menu_move.wav
|
||||
sound_accept=menu_select.wav
|
||||
|
||||
name=TITLE
|
||||
x=0
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
Director::Director(std::string path)
|
||||
{
|
||||
// Inicializa variables
|
||||
section.name = PROG_SECTION_GAME;
|
||||
section.subsection = GAME_SECTION_PLAY_1P;
|
||||
section.name = PROG_SECTION_LOGO;
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "/../");
|
||||
@@ -183,7 +182,6 @@ bool Director::setFileList()
|
||||
asset->add("data/sound/hiscore.wav", t_sound);
|
||||
asset->add("data/sound/itemdrop.wav", t_sound);
|
||||
asset->add("data/sound/itempickup.wav", t_sound);
|
||||
asset->add("data/sound/menu_cancel.wav", t_sound);
|
||||
asset->add("data/sound/menu_move.wav", t_sound);
|
||||
asset->add("data/sound/menu_select.wav", t_sound);
|
||||
asset->add("data/sound/player_collision.wav", t_sound);
|
||||
@@ -213,6 +211,7 @@ bool Director::setFileList()
|
||||
asset->add("data/gfx/intro.png", t_bitmap);
|
||||
asset->add("data/gfx/logo.png", t_bitmap);
|
||||
asset->add("data/gfx/menu_game_over.png", t_bitmap);
|
||||
asset->add("data/gfx/menu_game_over_end.png", t_bitmap);
|
||||
|
||||
asset->add("data/gfx/item_points1_disk.png", t_bitmap);
|
||||
asset->add("data/gfx/item_points1_disk.ani", t_data);
|
||||
@@ -238,16 +237,19 @@ bool Director::setFileList()
|
||||
asset->add("data/gfx/player_body.ani", t_data);
|
||||
asset->add("data/gfx/player_legs.ani", t_data);
|
||||
asset->add("data/gfx/player_death.ani", t_data);
|
||||
asset->add("data/gfx/player_fire.ani", t_data);
|
||||
|
||||
asset->add("data/gfx/player_bal1_head.png", t_bitmap);
|
||||
asset->add("data/gfx/player_bal1_body.png", t_bitmap);
|
||||
asset->add("data/gfx/player_bal1_legs.png", t_bitmap);
|
||||
asset->add("data/gfx/player_bal1_death.png", t_bitmap);
|
||||
asset->add("data/gfx/player_bal1_fire.png", t_bitmap);
|
||||
|
||||
asset->add("data/gfx/player_arounder_head.png", t_bitmap);
|
||||
asset->add("data/gfx/player_arounder_body.png", t_bitmap);
|
||||
asset->add("data/gfx/player_arounder_legs.png", t_bitmap);
|
||||
asset->add("data/gfx/player_arounder_death.png", t_bitmap);
|
||||
asset->add("data/gfx/player_arounder_fire.png", t_bitmap);
|
||||
|
||||
// Fuentes
|
||||
asset->add("data/font/8bithud.png", t_font);
|
||||
@@ -273,6 +275,7 @@ bool Director::setFileList()
|
||||
asset->add("data/menu/options.men", t_data);
|
||||
asset->add("data/menu/pause.men", t_data);
|
||||
asset->add("data/menu/gameover.men", t_data);
|
||||
asset->add("data/menu/player_select.men", t_data);
|
||||
|
||||
return asset->check();
|
||||
}
|
||||
@@ -298,6 +301,7 @@ bool Director::loadConfigFile()
|
||||
options->windowSize = 3;
|
||||
options->language = ba_BA;
|
||||
options->difficulty = DIFFICULTY_NORMAL;
|
||||
options->playerSelected = 0;
|
||||
options->filter = FILTER_NEAREST;
|
||||
options->vSync = true;
|
||||
options->screenWidth = GAME_WIDTH;
|
||||
|
||||
555
source/game.cpp
@@ -45,6 +45,7 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
||||
grassSprite = new Sprite(0, 0, 256, 6, gameGrassTexture, renderer);
|
||||
powerMeterSprite = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 7, gamePowerMeterTexture, renderer);
|
||||
gameOverSprite = new Sprite(16, 80, 128, 96, gameOverTexture, renderer);
|
||||
gameOverEndSprite = new Sprite(PLAY_AREA_CENTER_X - gameOverEndTexture->getWidth() / 2, 80, 128, 96, gameOverEndTexture, renderer);
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Game'
|
||||
init();
|
||||
@@ -88,6 +89,9 @@ Game::~Game()
|
||||
gameOverTexture->unload();
|
||||
delete gameOverTexture;
|
||||
|
||||
gameOverEndTexture->unload();
|
||||
delete gameOverEndTexture;
|
||||
|
||||
// Animaciones
|
||||
for (auto animation : playerAnimations)
|
||||
{
|
||||
@@ -157,6 +161,8 @@ Game::~Game()
|
||||
delete skyColorsSprite;
|
||||
delete grassSprite;
|
||||
delete powerMeterSprite;
|
||||
delete gameOverSprite;
|
||||
delete gameOverEndSprite;
|
||||
|
||||
JA_DeleteSound(balloonSound);
|
||||
JA_DeleteSound(bulletSound);
|
||||
@@ -183,23 +189,24 @@ void Game::init()
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
|
||||
// Crea los jugadores
|
||||
// Elimina qualquier jugador que hubiese antes de crear los nuevos
|
||||
for (auto player : players)
|
||||
{
|
||||
delete player;
|
||||
};
|
||||
players.clear();
|
||||
|
||||
// Crea los jugadores
|
||||
if (numPlayers == 1)
|
||||
{
|
||||
Player *player = new Player(PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24, renderer, player1Textures, playerAnimations);
|
||||
Player *player = new Player(PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures.at(options->playerSelected), playerAnimations);
|
||||
players.push_back(player);
|
||||
}
|
||||
|
||||
else if (numPlayers == 2)
|
||||
{
|
||||
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, player1Textures, playerAnimations);
|
||||
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, player2Textures, playerAnimations);
|
||||
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures.at(0), playerAnimations);
|
||||
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures.at(1), playerAnimations);
|
||||
players.push_back(player1);
|
||||
players.push_back(player2);
|
||||
}
|
||||
@@ -212,12 +219,15 @@ void Game::init()
|
||||
difficultyScoreMultiplier = 0.5f;
|
||||
difficultyColor = {75, 105, 47};
|
||||
pauseMenu->setSelectorColor(difficultyColor, 255);
|
||||
gameOverMenu->setSelectorColor(difficultyColor, 255);
|
||||
break;
|
||||
|
||||
case DIFFICULTY_NORMAL:
|
||||
defaultEnemySpeed = BALLOON_SPEED_1;
|
||||
difficultyScoreMultiplier = 1.0f;
|
||||
difficultyColor = {46, 63, 71};
|
||||
difficultyColor = {255, 122, 0};
|
||||
pauseMenu->setSelectorColor(difficultyColor, 255);
|
||||
gameOverMenu->setSelectorColor(difficultyColor, 255);
|
||||
break;
|
||||
|
||||
case DIFFICULTY_HARD:
|
||||
@@ -225,11 +235,13 @@ void Game::init()
|
||||
difficultyScoreMultiplier = 1.5f;
|
||||
difficultyColor = {118, 66, 138};
|
||||
pauseMenu->setSelectorColor(difficultyColor, 255);
|
||||
gameOverMenu->setSelectorColor(difficultyColor, 255);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gameCompleted = false;
|
||||
gameCompletedCounter = 0;
|
||||
section.name = PROG_SECTION_GAME;
|
||||
@@ -289,6 +301,12 @@ void Game::init()
|
||||
balloonsPopped += stage[i].powerToComplete;
|
||||
}
|
||||
|
||||
totalPowerToCompleteGame = 0;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
totalPowerToCompleteGame += stage[i].powerToComplete;
|
||||
}
|
||||
|
||||
// Modo demo
|
||||
demo.recording = false;
|
||||
demo.counter = 0;
|
||||
@@ -379,6 +397,7 @@ void Game::loadMedia()
|
||||
gameSkyColorsTexture = new LTexture(renderer, asset->get("game_sky_colors.png"));
|
||||
gameTextTexture = new LTexture(renderer, asset->get("game_text.png"));
|
||||
gameOverTexture = new LTexture(renderer, asset->get("menu_game_over.png"));
|
||||
gameOverEndTexture = new LTexture(renderer, asset->get("menu_game_over_end.png"));
|
||||
|
||||
// Texturas - Globos
|
||||
LTexture *balloon1Texture = new LTexture(renderer, asset->get("balloon1.png"));
|
||||
@@ -425,6 +444,11 @@ void Game::loadMedia()
|
||||
LTexture *player1Death = new LTexture(renderer, asset->get("player_bal1_death.png"));
|
||||
player1Textures.push_back(player1Death);
|
||||
|
||||
LTexture *player1Fire = new LTexture(renderer, asset->get("player_bal1_fire.png"));
|
||||
player1Textures.push_back(player1Fire);
|
||||
|
||||
playerTextures.push_back(player1Textures);
|
||||
|
||||
// Texturas - Player2
|
||||
LTexture *player2Head = new LTexture(renderer, asset->get("player_arounder_head.png"));
|
||||
player2Textures.push_back(player2Head);
|
||||
@@ -438,6 +462,11 @@ void Game::loadMedia()
|
||||
LTexture *player2Death = new LTexture(renderer, asset->get("player_arounder_death.png"));
|
||||
player2Textures.push_back(player2Death);
|
||||
|
||||
LTexture *player2Fire = new LTexture(renderer, asset->get("player_arounder_fire.png"));
|
||||
player2Textures.push_back(player2Fire);
|
||||
|
||||
playerTextures.push_back(player2Textures);
|
||||
|
||||
// Animaciones -- Jugador
|
||||
std::vector<std::string> *playerHeadAnimation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("player_head.ani"), playerHeadAnimation);
|
||||
@@ -455,6 +484,10 @@ void Game::loadMedia()
|
||||
loadAnimations(asset->get("player_death.ani"), playerDeathAnimation);
|
||||
playerAnimations.push_back(playerDeathAnimation);
|
||||
|
||||
std::vector<std::string> *playerFireAnimation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("player_fire.ani"), playerFireAnimation);
|
||||
playerAnimations.push_back(playerFireAnimation);
|
||||
|
||||
// Animaciones -- Globos
|
||||
std::vector<std::string> *balloon1Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon1.ani"), balloon1Animation);
|
||||
@@ -508,9 +541,13 @@ void Game::loadMedia()
|
||||
gameOverMenu = new Menu(renderer, asset, input, asset->get("gameover.men"));
|
||||
gameOverMenu->setItemCaption(0, lang->getText(48));
|
||||
gameOverMenu->setItemCaption(1, lang->getText(49));
|
||||
const int w = text->getCharacterSize() * lang->getText(45).length();
|
||||
gameOverMenu->setRectSize(w, 0);
|
||||
gameOverMenu->centerMenuOnX(199);
|
||||
pauseMenu = new Menu(renderer, asset, input, asset->get("pause.men"));
|
||||
pauseMenu->setItemCaption(0, lang->getText(46));
|
||||
pauseMenu->setItemCaption(1, lang->getText(47));
|
||||
pauseMenu->setItemCaption(0, lang->getText(41));
|
||||
pauseMenu->setItemCaption(1, lang->getText(46));
|
||||
pauseMenu->setItemCaption(2, lang->getText(47));
|
||||
|
||||
// Sonidos
|
||||
balloonSound = JA_LoadSound(asset->get("balloon.wav").c_str());
|
||||
@@ -1491,7 +1528,6 @@ void Game::updateHiScore()
|
||||
{
|
||||
// Si la puntuación actual es mayor que la máxima puntuación
|
||||
for (auto player : players)
|
||||
// for (int i = 0; i < numPlayers; i++)
|
||||
if (player->getScore() > hiScore)
|
||||
{
|
||||
// Actualiza la máxima puntuación
|
||||
@@ -1513,8 +1549,6 @@ void Game::updateHiScore()
|
||||
// Transforma un valor numérico en una cadena de 6 cifras
|
||||
std::string Game::updateScoreText(Uint32 num)
|
||||
{
|
||||
// return (std::to_string(num));
|
||||
|
||||
if ((num >= 0) && (num <= 9))
|
||||
{
|
||||
return ("000000" + std::to_string(num));
|
||||
@@ -1557,7 +1591,14 @@ std::string Game::updateScoreText(Uint32 num)
|
||||
void Game::renderScoreBoard()
|
||||
{
|
||||
// Dibuja el fondo del marcador
|
||||
SDL_SetRenderDrawColor(renderer, difficultyColor.r, difficultyColor.g, difficultyColor.b, 255);
|
||||
if (difficulty == DIFFICULTY_NORMAL)
|
||||
{ // Pone el color gris de siempre
|
||||
SDL_SetRenderDrawColor(renderer, 46, 63, 71, 255);
|
||||
}
|
||||
else
|
||||
{ // Pinta el fondo del marcador del color de la dificultad
|
||||
SDL_SetRenderDrawColor(renderer, difficultyColor.r, difficultyColor.g, difficultyColor.b, 255);
|
||||
}
|
||||
SDL_Rect rect = {0, 160, 256, 32};
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
@@ -1673,8 +1714,7 @@ void Game::updateStage()
|
||||
stage[currentStage].currentPower = 0; // Vuelve a dejar el poder a cero, por lo que hubiera podido subir al destruir todos lo globos
|
||||
menaceCurrent = 255; // Sube el nivel de amenaza para que no cree mas globos
|
||||
for (auto player : players)
|
||||
// for (int i = 0; i < numPlayers; i++) // Añade un millon de puntos a los jugadores que queden vivos
|
||||
{
|
||||
{ // Añade un millon de puntos a los jugadores que queden vivos
|
||||
if (player->isAlive())
|
||||
{
|
||||
player->addScore(1000000);
|
||||
@@ -1740,8 +1780,7 @@ void Game::updateDeath()
|
||||
|
||||
// Renderiza el fade final cuando se acaba la partida
|
||||
void Game::renderDeathFade(int counter)
|
||||
// Counter debe ir de 0 a 150
|
||||
{
|
||||
{ // Counter debe ir de 0 a 150
|
||||
SDL_SetRenderDrawColor(renderer, 0x27, 0x27, 0x36, 255);
|
||||
|
||||
if (counter < 150)
|
||||
@@ -1749,15 +1788,19 @@ void Game::renderDeathFade(int counter)
|
||||
// 192 / 6 = 32, 6 cuadrados de 32 pixeles
|
||||
SDL_Rect rect[12];
|
||||
Uint8 h = counter / 3;
|
||||
for (int i = 0; i < 12; i++)
|
||||
for (int i = 0; i < 12; ++i)
|
||||
{
|
||||
rect[i].x = 0;
|
||||
rect[i].y = i * 16;
|
||||
rect[i].w = GAME_WIDTH;
|
||||
if (i == 0)
|
||||
{
|
||||
rect[i].h = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect[i].h = std::max(rect[i - 1].h - 3, 0);
|
||||
}
|
||||
SDL_RenderFillRect(renderer, &rect[i]);
|
||||
}
|
||||
}
|
||||
@@ -2700,10 +2743,7 @@ void Game::update()
|
||||
checkBulletBalloonCollision();
|
||||
|
||||
// Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos
|
||||
if (!gameCompleted)
|
||||
{
|
||||
updateMenace();
|
||||
}
|
||||
updateMenace();
|
||||
|
||||
// Actualiza la velocidad de los enemigos
|
||||
updateBalloonSpeed();
|
||||
@@ -2722,11 +2762,38 @@ void Game::update()
|
||||
// Actualiza el fondo
|
||||
void Game::updateBackground()
|
||||
{
|
||||
if (!gameCompleted)
|
||||
{ // Si el juego no esta completo, la velocidad de las nubes es igual a los globos explotados
|
||||
cloudsSpeed = balloonsPopped;
|
||||
}
|
||||
else
|
||||
{ // Si el juego está completado, se reduce la velocidad de las nubes
|
||||
if (cloudsSpeed > 400)
|
||||
{
|
||||
cloudsSpeed -= 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
cloudsSpeed = 200;
|
||||
}
|
||||
}
|
||||
|
||||
// Calcula la velocidad en función de los globos explotados y el total de globos a explotar para acabar el juego
|
||||
const float speed = (-0.2f) + (-3.00f * ((float)cloudsSpeed / (float)totalPowerToCompleteGame));
|
||||
|
||||
// Aplica la velocidad calculada a las nubes
|
||||
clouds1A->setVelX(speed);
|
||||
clouds1B->setVelX(speed);
|
||||
clouds2A->setVelX(speed / 2);
|
||||
clouds2B->setVelX(speed / 2);
|
||||
|
||||
// Mueve las nubes
|
||||
clouds1A->move();
|
||||
clouds1B->move();
|
||||
clouds2A->move();
|
||||
clouds2B->move();
|
||||
|
||||
// Calcula el offset de las nubes
|
||||
if (clouds1A->getPosX() < -clouds1A->getWidth())
|
||||
{
|
||||
clouds1A->setPosX(clouds1A->getWidth());
|
||||
@@ -2747,8 +2814,10 @@ void Game::updateBackground()
|
||||
clouds2B->setPosX(clouds2B->getWidth());
|
||||
}
|
||||
|
||||
// Calcula el frame de la hierba
|
||||
grassSprite->setSpriteClip(0, (6 * (counter / 20 % 2)), 256, 6);
|
||||
|
||||
// Mueve los edificios en funcion de si está activo el efecto de agitarlos
|
||||
if (effect.shake)
|
||||
{
|
||||
buildingsSprite->setPosX(((effect.shakeCounter % 2) * 2) - 1);
|
||||
@@ -2762,7 +2831,7 @@ void Game::updateBackground()
|
||||
// Dibuja el fondo
|
||||
void Game::renderBackground()
|
||||
{
|
||||
const float gradientNumber = std::min(((float)balloonsPopped / 1000.0f), 3.0f);
|
||||
const float gradientNumber = std::min(((float)balloonsPopped / 1250.0f), 3.0f);
|
||||
const float percent = gradientNumber - (int)gradientNumber;
|
||||
const int alpha = std::max((255 - (int)(255 * percent)), 0);
|
||||
|
||||
@@ -2813,9 +2882,9 @@ void Game::render()
|
||||
renderDeathFade(150 - deathCounter);
|
||||
}
|
||||
|
||||
if ((gameCompleted) && (gameCompletedCounter >= 300))
|
||||
if ((gameCompleted) && (gameCompletedCounter >= GAME_COMPLETED_START_FADE))
|
||||
{
|
||||
renderDeathFade(gameCompletedCounter - 300);
|
||||
renderDeathFade(gameCompletedCounter - GAME_COMPLETED_START_FADE);
|
||||
}
|
||||
|
||||
renderFlashEffect();
|
||||
@@ -2827,6 +2896,11 @@ void Game::render()
|
||||
// Gestiona el nivel de amenaza
|
||||
void Game::updateMenace()
|
||||
{
|
||||
if (gameCompleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const float percent = stage[currentStage].currentPower / stage[currentStage].powerToComplete;
|
||||
const Uint8 difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
|
||||
|
||||
@@ -3203,6 +3277,97 @@ section_t Game::run()
|
||||
return section;
|
||||
}
|
||||
|
||||
// Actualiza las variables del menu de pausa del juego
|
||||
void Game::updatePausedGame()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
checkEventHandler();
|
||||
|
||||
// Calcula la lógica de los objetos
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Actualiza la lógica del menu de pausa
|
||||
pauseMenu->update();
|
||||
|
||||
// Comprueba las entradas para el menu
|
||||
pauseMenu->checkInput();
|
||||
|
||||
// Comprueba si se ha seleccionado algún item del menú
|
||||
switch (pauseMenu->getItemSelected())
|
||||
{
|
||||
case 1:
|
||||
section.name = PROG_SECTION_GAME;
|
||||
section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
||||
|
||||
if (JA_GetMusicState() == JA_MUSIC_PAUSED)
|
||||
{
|
||||
JA_ResumeMusic();
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
fade->setFadeType(FADE_CENTER);
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Actualiza el fade
|
||||
fade->update();
|
||||
if (fade->hasEnded())
|
||||
{
|
||||
section.name = PROG_SECTION_TITLE;
|
||||
section.subsection = TITLE_SECTION_1;
|
||||
JA_StopMusic();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el menu de pausa del juego
|
||||
void Game::renderPausedGame()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Pinta el escenario
|
||||
{
|
||||
renderBackground();
|
||||
renderBalloons();
|
||||
renderBullets();
|
||||
renderMessages();
|
||||
renderItems();
|
||||
renderSmartSprites();
|
||||
renderScoreBoard();
|
||||
renderPlayers();
|
||||
|
||||
if ((deathCounter <= 150) && !players.at(0)->isAlive())
|
||||
{
|
||||
renderDeathFade(150 - deathCounter);
|
||||
}
|
||||
|
||||
if ((gameCompleted) && (gameCompletedCounter >= GAME_COMPLETED_START_FADE))
|
||||
{
|
||||
renderDeathFade(gameCompletedCounter - GAME_COMPLETED_START_FADE);
|
||||
}
|
||||
|
||||
renderFlashEffect();
|
||||
}
|
||||
|
||||
pauseMenu->render();
|
||||
fade->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
// Bucle para el menu de pausa del juego
|
||||
void Game::runPausedGame()
|
||||
{
|
||||
@@ -3211,104 +3376,165 @@ void Game::runPausedGame()
|
||||
|
||||
while ((section.subsection == GAME_SECTION_PAUSE) && (section.name == PROG_SECTION_GAME))
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
checkEventHandler();
|
||||
updatePausedGame();
|
||||
renderPausedGame();
|
||||
}
|
||||
}
|
||||
|
||||
// Calcula la lógica de los objetos
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
// Actualiza los elementos de la pantalla de game over
|
||||
void Game::updateGameOverScreen()
|
||||
{
|
||||
// Variables
|
||||
static int postFade = 0;
|
||||
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Actualiza la lógica del menu
|
||||
pauseMenu->update();
|
||||
fade->update();
|
||||
if (fade->hasEnded())
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
|
||||
{
|
||||
if (gameCompleted)
|
||||
{
|
||||
postFade = 1;
|
||||
fade->activateFade();
|
||||
JA_PlaySound(itemPickUpSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calcula la lógica de los objetos
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Actualiza la lógica del menu
|
||||
gameOverMenu->update();
|
||||
|
||||
// Actualiza el fade
|
||||
fade->update();
|
||||
|
||||
// Si ha terminado el fade, actua segun se haya operado
|
||||
if (fade->hasEnded())
|
||||
{
|
||||
switch (postFade)
|
||||
{
|
||||
case 0: // YES
|
||||
section.name = PROG_SECTION_GAME;
|
||||
deleteAllVectorObjects();
|
||||
init();
|
||||
section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
||||
break;
|
||||
|
||||
case 1: // NO
|
||||
section.name = PROG_SECTION_TITLE;
|
||||
section.subsection = TITLE_SECTION_1;
|
||||
JA_StopMusic();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Pinta el escenario
|
||||
// Comprueba las entradas para el menu solo si no esta el juego completo
|
||||
if (!gameCompleted)
|
||||
{
|
||||
renderBackground();
|
||||
renderBalloons();
|
||||
renderBullets();
|
||||
renderMessages();
|
||||
renderItems();
|
||||
renderSmartSprites();
|
||||
renderScoreBoard();
|
||||
renderPlayers();
|
||||
gameOverMenu->checkInput();
|
||||
|
||||
if ((deathCounter <= 150) && !players.at(0)->isAlive())
|
||||
// Comprueba si se ha seleccionado algún item del menú
|
||||
switch (gameOverMenu->getItemSelected())
|
||||
{
|
||||
renderDeathFade(150 - deathCounter);
|
||||
case 0: // YES
|
||||
postFade = 0;
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
case 1: // NO
|
||||
postFade = 1;
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((gameCompleted) && (gameCompletedCounter >= 300))
|
||||
{
|
||||
renderDeathFade(gameCompletedCounter - 300);
|
||||
}
|
||||
|
||||
renderFlashEffect();
|
||||
}
|
||||
|
||||
pauseMenu->render();
|
||||
fade->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
|
||||
// Comprueba las entradas para el menu
|
||||
pauseMenu->checkInput();
|
||||
|
||||
// Comprueba si se ha seleccionado algún item del menú
|
||||
switch (pauseMenu->getItemSelected())
|
||||
{
|
||||
case 0:
|
||||
section.name = PROG_SECTION_GAME;
|
||||
|
||||
if (numPlayers == 1)
|
||||
{
|
||||
section.subsection = GAME_SECTION_PLAY_1P;
|
||||
}
|
||||
else
|
||||
{
|
||||
section.subsection = GAME_SECTION_PLAY_2P;
|
||||
}
|
||||
|
||||
if (JA_GetMusicState() == JA_MUSIC_PAUSED)
|
||||
{
|
||||
JA_ResumeMusic();
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
fade->setFadeType(FADE_CENTER);
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja los elementos de la pantalla de game over
|
||||
void Game::renderGameOverScreen()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Dibujo
|
||||
if (!gameCompleted)
|
||||
{ // Dibujo de haber perdido la partida
|
||||
gameOverSprite->render();
|
||||
}
|
||||
else
|
||||
{ // Dinujo de haber completado la partida
|
||||
gameOverEndSprite->render();
|
||||
}
|
||||
|
||||
// Dibuja los objetos
|
||||
if (numPlayers == 1)
|
||||
{
|
||||
// Congratulations!!
|
||||
if (gameCompleted)
|
||||
{
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 8), lang->getText(50));
|
||||
}
|
||||
|
||||
// Game Over
|
||||
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 6), lang->getText(43));
|
||||
|
||||
// Your Score
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 3), lang->getText(44) + std::to_string(players.at(0)->getScore()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Congratulations!!
|
||||
if (gameCompleted)
|
||||
{
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 9), lang->getText(50));
|
||||
}
|
||||
|
||||
// Game Over
|
||||
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 7), lang->getText(43));
|
||||
|
||||
// Player1 Score
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), lang->getText(77) + std::to_string(players.at(0)->getScore()));
|
||||
|
||||
// Player2 Score
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 2), lang->getText(78) + std::to_string(players.at(1)->getScore()));
|
||||
}
|
||||
|
||||
// Continue?
|
||||
if (!gameCompleted)
|
||||
{ // Solo dibuja el menu de continuar en el caso de no haber completado la partida
|
||||
text->writeCentered(199, PLAY_AREA_CENTER_Y + BLOCK * 3, lang->getText(45));
|
||||
gameOverMenu->render();
|
||||
}
|
||||
|
||||
// Pinta el fade
|
||||
fade->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de game over
|
||||
void Game::runGameOverScreen()
|
||||
{
|
||||
// Variables
|
||||
int postFade = 0;
|
||||
|
||||
// Guarda los puntos
|
||||
saveScoreFile();
|
||||
|
||||
@@ -3317,101 +3543,8 @@ void Game::runGameOverScreen()
|
||||
|
||||
while ((section.subsection == GAME_SECTION_GAMEOVER) && (section.name == PROG_SECTION_GAME))
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Calcula la lógica de los objetos
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Actualiza la lógica del menu
|
||||
gameOverMenu->update();
|
||||
fade->update();
|
||||
if (fade->hasEnded())
|
||||
{
|
||||
switch (postFade)
|
||||
{
|
||||
case 0: // YES
|
||||
section.name = PROG_SECTION_GAME;
|
||||
deleteAllVectorObjects();
|
||||
init();
|
||||
section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
||||
break;
|
||||
|
||||
case 1: // NO
|
||||
section.name = PROG_SECTION_TITLE;
|
||||
section.subsection = TITLE_SECTION_1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
|
||||
// Dibujo
|
||||
gameOverSprite->render();
|
||||
|
||||
// Dibuja los objetos
|
||||
if (numPlayers == 1)
|
||||
{
|
||||
// Game Over
|
||||
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 6), lang->getText(43));
|
||||
|
||||
// Your Score
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 3), lang->getText(44) + std::to_string(players.at(0)->getScore()));
|
||||
}
|
||||
else
|
||||
{
|
||||
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 36, lang->getText(43));
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 12, lang->getText(77) + std::to_string(players.at(0)->getScore()));
|
||||
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y, lang->getText(78) + std::to_string(players.at(1)->getScore()));
|
||||
}
|
||||
// Continue?
|
||||
text->writeCentered(99, PLAY_AREA_CENTER_Y + BLOCK * 2, lang->getText(45));
|
||||
gameOverMenu->render();
|
||||
fade->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
|
||||
// Comprueba las entradas para el menu
|
||||
gameOverMenu->checkInput();
|
||||
|
||||
// Comprueba si se ha seleccionado algún item del menú
|
||||
switch (gameOverMenu->getItemSelected())
|
||||
{
|
||||
case 0: // YES
|
||||
postFade = 0;
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
case 1: // NO
|
||||
postFade = 1;
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
updateGameOverScreen();
|
||||
renderGameOverScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3458,7 +3591,7 @@ void Game::initPaths()
|
||||
const int centerPoint = PLAY_AREA_CENTER_Y - (BLOCK * 2);
|
||||
const int distance = (PLAY_AREA_BOTTOM) - (PLAY_AREA_CENTER_Y - 16);
|
||||
|
||||
for (int i = 0; i < STAGE_COUNTER; i++)
|
||||
for (int i = 0; i < STAGE_COUNTER; ++i)
|
||||
{
|
||||
if (i < firstPart)
|
||||
{
|
||||
@@ -3488,7 +3621,7 @@ void Game::initPaths()
|
||||
const float distance1 = finish1 - start1;
|
||||
const float distance2 = finish2 - start2;
|
||||
|
||||
for (int i = 0; i < STAGE_COUNTER; i++)
|
||||
for (int i = 0; i < STAGE_COUNTER; ++i)
|
||||
{
|
||||
if (i < firstPart)
|
||||
{
|
||||
@@ -3496,10 +3629,12 @@ void Game::initPaths()
|
||||
getReadyBitmapPath[i] *= distance1;
|
||||
getReadyBitmapPath[i] -= size;
|
||||
}
|
||||
|
||||
else if (i < secondPart)
|
||||
{
|
||||
getReadyBitmapPath[i] = (int)finish1;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
getReadyBitmapPath[i] = sin[(int)((i - 150) * 1.8f)];
|
||||
@@ -3517,7 +3652,7 @@ void Game::updateGameCompleted()
|
||||
gameCompletedCounter++;
|
||||
}
|
||||
|
||||
if (gameCompletedCounter == 500)
|
||||
if (gameCompletedCounter == GAME_COMPLETED_END)
|
||||
{
|
||||
section.subsection = GAME_SECTION_GAMEOVER;
|
||||
}
|
||||
@@ -3609,28 +3744,6 @@ void Game::checkEventHandler()
|
||||
reloadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_P:
|
||||
createPowerBall();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_O:
|
||||
stopAllBalloons(200);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_I:
|
||||
static bool toogle = true;
|
||||
if (toogle)
|
||||
{
|
||||
players.at(0)->setPlayerTextures(player1Textures);
|
||||
toogle = !toogle;
|
||||
}
|
||||
else
|
||||
{
|
||||
players.at(0)->setPlayerTextures(player2Textures);
|
||||
toogle = !toogle;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#define STAGE_COUNTER 200
|
||||
#define SHAKE_COUNTER 10
|
||||
#define HELP_COUNTER 1000
|
||||
#define GAME_COMPLETED_START_FADE 500
|
||||
#define GAME_COMPLETED_END 700
|
||||
|
||||
// Formaciones enemigas
|
||||
#define NUMBER_OF_ENEMY_FORMATIONS 100
|
||||
@@ -125,11 +127,12 @@ private:
|
||||
std::vector<Item *> items; // Vector con los items
|
||||
std::vector<SmartSprite *> smartSprites; // Vector con los smartsprites
|
||||
|
||||
LTexture *bulletTexture; // Textura para las balas
|
||||
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items
|
||||
std::vector<LTexture *> balloonTextures; // Vector con las texturas de los globos
|
||||
std::vector<LTexture *> player1Textures; // Vector con las texturas del jugador
|
||||
std::vector<LTexture *> player2Textures; // Vector con las texturas del jugador
|
||||
LTexture *bulletTexture; // Textura para las balas
|
||||
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items
|
||||
std::vector<LTexture *> balloonTextures; // Vector con las texturas de los globos
|
||||
std::vector<LTexture *> player1Textures; // Vector con las texturas del jugador
|
||||
std::vector<LTexture *> player2Textures; // Vector con las texturas del jugador
|
||||
std::vector<std::vector<LTexture *>> playerTextures; // Vector con todas las texturas de los jugadores;
|
||||
|
||||
LTexture *gameBuildingsTexture; // Textura con los edificios de fondo
|
||||
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
|
||||
@@ -138,6 +141,7 @@ private:
|
||||
LTexture *gameSkyColorsTexture; // Textura con los diferentes colores de fondo del juego
|
||||
LTexture *gameTextTexture; // Textura para los sprites con textos
|
||||
LTexture *gameOverTexture; // Textura para la pantalla de game over
|
||||
LTexture *gameOverEndTexture; // Textura para la pantalla de game over de acabar el juego
|
||||
|
||||
std::vector<std::vector<std::string> *> itemAnimations; // Vector con las animaciones de los items
|
||||
std::vector<std::vector<std::string> *> playerAnimations; // Vector con las animaciones del jugador
|
||||
@@ -163,11 +167,12 @@ private:
|
||||
SmartSprite *n2500Sprite; // Sprite con el texto 2.500
|
||||
SmartSprite *n5000Sprite; // Sprite con el texto 5.000
|
||||
|
||||
Sprite *buildingsSprite; // Sprite con los edificios de fondo
|
||||
Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo
|
||||
Sprite *grassSprite; // Sprite para la hierba
|
||||
Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase
|
||||
Sprite *gameOverSprite; // Sprite para dibujar los graficos del game over
|
||||
Sprite *buildingsSprite; // Sprite con los edificios de fondo
|
||||
Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo
|
||||
Sprite *grassSprite; // Sprite para la hierba
|
||||
Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase
|
||||
Sprite *gameOverSprite; // Sprite para dibujar los graficos del game over
|
||||
Sprite *gameOverEndSprite; // Sprite para dibujar los graficos del game over de acabar el juego
|
||||
|
||||
JA_Sound balloonSound; // Sonido para la explosión del globo
|
||||
JA_Sound bulletSound; // Sonido para los disparos
|
||||
@@ -229,6 +234,8 @@ private:
|
||||
enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
|
||||
Uint8 lastStageReached; // Contiene el numero de la última pantalla que se ha alcanzado
|
||||
demo_t demo; // Variable con todas las variables relacionadas con el modo demo
|
||||
int totalPowerToCompleteGame; // La suma del poder necesario para completar todas las fases
|
||||
int cloudsSpeed; // Velocidad a la que se desplazan las nubes
|
||||
|
||||
// Actualiza el juego
|
||||
void update();
|
||||
@@ -458,9 +465,21 @@ private:
|
||||
// Agita la pantalla
|
||||
void shakeScreen();
|
||||
|
||||
// Actualiza las variables del menu de pausa del juego
|
||||
void updatePausedGame();
|
||||
|
||||
// Dibuja el menu de pausa del juego
|
||||
void renderPausedGame();
|
||||
|
||||
// Bucle para el menu de pausa del juego
|
||||
void runPausedGame();
|
||||
|
||||
// Actualiza los elementos de la pantalla de game over
|
||||
void updateGameOverScreen();
|
||||
|
||||
// Dibuja los elementos de la pantalla de game over
|
||||
void renderGameOverScreen();
|
||||
|
||||
// Bucle para la pantalla de game over
|
||||
void runGameOverScreen();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file)
|
||||
itemSelected = MENU_NO_OPTION;
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = 0;
|
||||
rectBG.rect = {0, 0, 0, 0};
|
||||
rectBG.color = {0, 0, 0};
|
||||
rectBG.a = 0;
|
||||
@@ -57,6 +58,9 @@ Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file)
|
||||
{
|
||||
load(file);
|
||||
}
|
||||
|
||||
// Deja el cursor en el primer elemento
|
||||
reset();
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
@@ -491,6 +495,13 @@ void Menu::reset()
|
||||
selector.originH = selector.targetH = item[0].rect.h;
|
||||
selector.moving = false;
|
||||
selector.resizing = false;
|
||||
|
||||
// Si el primer elemento no es seleccionable, incrementa el selector
|
||||
if (!item[selector.index].selectable)
|
||||
{
|
||||
increaseSelectorIndex();
|
||||
setSelectorPos(selector.index);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño
|
||||
@@ -608,8 +619,6 @@ void Menu::render()
|
||||
|
||||
// Renderiza el rectangulo del selector
|
||||
const SDL_Rect temp = {selector.rect.x, selector.rect.y - 1, selector.rect.w, selector.rect.h + 1};
|
||||
// temp.y--;
|
||||
// temp.h++;
|
||||
SDL_SetRenderDrawColor(renderer, selector.color.r, selector.color.g, selector.color.b, selector.a);
|
||||
SDL_RenderFillRect(renderer, &temp);
|
||||
|
||||
@@ -628,17 +637,18 @@ void Menu::render()
|
||||
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
|
||||
}
|
||||
|
||||
else if (item[i].selectable)
|
||||
{
|
||||
text->write(item[i].rect.x, item[i].rect.y, item[i].label);
|
||||
}
|
||||
|
||||
else if (item[i].greyed)
|
||||
{
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed);
|
||||
}
|
||||
else
|
||||
// No seleccionable
|
||||
{
|
||||
{ // No seleccionable
|
||||
if ((item[i].linkedUp) && (i == selector.index + 1))
|
||||
{
|
||||
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
||||
@@ -653,13 +663,45 @@ void Menu::render()
|
||||
}
|
||||
|
||||
// Establece el rectangulo de fondo del menu y el selector
|
||||
void Menu::setRectSize()
|
||||
void Menu::setRectSize(int w, int h)
|
||||
{
|
||||
rectBG.rect.w = findWidth() + text->getCharacterSize();
|
||||
rectBG.rect.h = findHeight() + text->getCharacterSize();
|
||||
// Establece el ancho
|
||||
if (w == 0)
|
||||
{ // Si no se pasa un valor, se busca si hay uno prefijado
|
||||
if (this->w == 0)
|
||||
{ // Si no hay prefijado, coge el item mas ancho
|
||||
rectBG.rect.w = findWidth() + text->getCharacterSize();
|
||||
}
|
||||
else
|
||||
{ // Si hay prefijado, coge ese
|
||||
rectBG.rect.w = this->w;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Si se pasa un valor, se usa y se prefija
|
||||
rectBG.rect.w = w;
|
||||
this->w = w;
|
||||
}
|
||||
|
||||
// Establece el alto
|
||||
if (h == 0)
|
||||
{ // Si no se pasa un valor, se busca de manera automatica
|
||||
rectBG.rect.h = findHeight() + text->getCharacterSize();
|
||||
}
|
||||
else
|
||||
{ // Si se pasa un valor, se aplica
|
||||
rectBG.rect.h = h;
|
||||
}
|
||||
|
||||
// La posición X es la del menú menos medio caracter
|
||||
rectBG.rect.x = x - (text->getCharacterSize() / 2);
|
||||
if (this->w != 0)
|
||||
{ // Si el ancho esta prefijado, la x coinccide
|
||||
rectBG.rect.x = x;
|
||||
}
|
||||
else
|
||||
{ // Si el ancho es automatico, se le da un poco de margen
|
||||
rectBG.rect.x = x - (text->getCharacterSize() / 2);
|
||||
}
|
||||
|
||||
// La posición Y es la del menu menos la altura de medio caracter
|
||||
rectBG.rect.y = y - (text->getCharacterSize() / 2);
|
||||
@@ -692,10 +734,28 @@ void Menu::setSelectorTextColor(color_t color)
|
||||
void Menu::centerMenuOnX(int value)
|
||||
{
|
||||
isCenteredOnX = true;
|
||||
centerX = value;
|
||||
if (value != 0)
|
||||
{
|
||||
centerX = value;
|
||||
}
|
||||
else if (centerX == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Establece la nueva posición centrada en funcion del elemento más ancho
|
||||
x = (value) - (findWidth() / 2);
|
||||
// Establece la nueva posición centrada en funcion del elemento más ancho o del ancho fijo del menu
|
||||
if (w != 0)
|
||||
{ // Si se ha definido un ancho fijo
|
||||
x = (centerX) - (w / 2);
|
||||
}
|
||||
else
|
||||
{ // Si se actua en función del elemento más ancho
|
||||
x = (centerX) - (findWidth() / 2);
|
||||
}
|
||||
|
||||
// Actualiza el rectangulo de fondo y del selector
|
||||
rectBG.rect.x = x;
|
||||
selector.rect.x = x;
|
||||
|
||||
// Reposiciona los elementos del menu
|
||||
for (auto &i : item)
|
||||
@@ -705,6 +765,12 @@ void Menu::centerMenuOnX(int value)
|
||||
|
||||
// Recalcula el rectangulo de fondo
|
||||
setRectSize();
|
||||
|
||||
// Vuelve a centrar los elementos si fuera el caso
|
||||
if (areElementsCenteredOnX)
|
||||
{
|
||||
centerMenuElementsOnX();
|
||||
}
|
||||
}
|
||||
|
||||
// Centra el menu respecto un punto en el eje Y
|
||||
@@ -777,9 +843,6 @@ void Menu::setItemCaption(int index, std::string text)
|
||||
item.at(index).rect.w = this->text->lenght(item.at(index).label);
|
||||
item.at(index).rect.h = this->text->getCharacterSize();
|
||||
reorganize();
|
||||
|
||||
const std::string t = item.at(index).label + ":" + std::to_string(item.at(index).rect.w);
|
||||
printf("Adding menu item -> %s\n", t.c_str());
|
||||
}
|
||||
|
||||
// Establece el indice del itemm que se usará por defecto al cancelar el menu
|
||||
|
||||
@@ -68,6 +68,13 @@ private:
|
||||
int a; // Cantidad de transparencia para el rectangulo del selector
|
||||
};
|
||||
|
||||
// Objetos
|
||||
SDL_Renderer *renderer; // Puntero al renderizador de la ventana
|
||||
Text *text; // Texto para poder escribir los items del menu
|
||||
Input *input; // Gestor de eventos de entrada de teclado o gamepad
|
||||
Asset *asset; // Objeto para gestionar los ficheros de recursos
|
||||
|
||||
// Variables
|
||||
std::string name; // Nombre del menu
|
||||
int x; // Posición en el eje X de la primera letra del primer elemento
|
||||
int y; // Posición en el eje Y de la primera letra del primer elemento
|
||||
@@ -85,10 +92,6 @@ private:
|
||||
JA_Sound soundAccept; // Sonido al aceptar o elegir una opción del menu
|
||||
JA_Sound soundCancel; // Sonido al cancelar el menu
|
||||
JA_Sound soundMove; // Sonido al mover el selector
|
||||
SDL_Renderer *renderer; // Puntero al renderizador de la ventana
|
||||
Text *text; // Texto para poder escribir los items del menu
|
||||
Input *input; // Gestor de eventos de entrada de teclado o gamepad
|
||||
Asset *asset; // Objeto para gestionar los ficheros de recursos
|
||||
color_t colorGreyed; // Color para los elementos agrisados
|
||||
rectangle_t rectBG; // Rectangulo de fondo del menu
|
||||
std::vector<item_t> item; // Estructura para cada elemento del menu
|
||||
@@ -108,9 +111,6 @@ private:
|
||||
// Inicializa las variables
|
||||
void init();
|
||||
|
||||
// Establece el rectangulo de fondo del menu
|
||||
void setRectSize();
|
||||
|
||||
// Actualiza el menu para recolocarlo correctamente y establecer el tamaño
|
||||
void reorganize();
|
||||
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file="");
|
||||
Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file = "");
|
||||
|
||||
// Destructor
|
||||
~Menu();
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
void setSelectorTextColor(color_t color);
|
||||
|
||||
// Centra el menu respecto a un punto en el eje X
|
||||
void centerMenuOnX(int value);
|
||||
void centerMenuOnX(int value = 0);
|
||||
|
||||
// Centra el menu respecto a un punto en el eje Y
|
||||
void centerMenuOnY(int value);
|
||||
@@ -219,6 +219,9 @@ public:
|
||||
|
||||
// Establece la fuente de texto que se utilizará
|
||||
void setText(std::string font_png, std::string font_txt);
|
||||
|
||||
// Establece el rectangulo de fondo del menu
|
||||
void setRectSize(int w = 0, int h = 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,8 @@ Player::Player(float x, int y, SDL_Renderer *renderer, std::vector<LTexture *> t
|
||||
bodySprite = new AnimatedSprite(texture.at(1), renderer, "", animations.at(1));
|
||||
legsSprite = new AnimatedSprite(texture.at(2), renderer, "", animations.at(2));
|
||||
deathSprite = new AnimatedSprite(texture.at(3), renderer, "", animations.at(3));
|
||||
fireSprite = new AnimatedSprite(texture.at(4), renderer, "", animations.at(4));
|
||||
fireSprite->getTexture()->setAlpha(224);
|
||||
|
||||
// Establece la posición inicial del jugador
|
||||
posX = x;
|
||||
@@ -27,6 +29,7 @@ Player::~Player()
|
||||
delete bodySprite;
|
||||
delete legsSprite;
|
||||
delete deathSprite;
|
||||
delete fireSprite;
|
||||
}
|
||||
|
||||
// Iniciador
|
||||
@@ -144,6 +147,9 @@ void Player::move()
|
||||
|
||||
headSprite->setPosX(getPosX());
|
||||
headSprite->setPosY(posY);
|
||||
|
||||
fireSprite->setPosX(getPosX() - 2);
|
||||
fireSprite->setPosY(posY - 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,6 +176,10 @@ void Player::render()
|
||||
{
|
||||
if ((invulnerableCounter % 10) > 4)
|
||||
{
|
||||
if (powerUp)
|
||||
{
|
||||
fireSprite->render();
|
||||
}
|
||||
legsSprite->render();
|
||||
bodySprite->render();
|
||||
headSprite->render();
|
||||
@@ -177,6 +187,10 @@ void Player::render()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerUp)
|
||||
{
|
||||
fireSprite->render();
|
||||
}
|
||||
legsSprite->render();
|
||||
bodySprite->render();
|
||||
headSprite->render();
|
||||
@@ -233,14 +247,14 @@ void Player::setAnimation()
|
||||
legsSprite->setFlip(flipWalk);
|
||||
if (statusFiring == PLAYER_STATUS_FIRING_NO)
|
||||
{ // No esta disparando
|
||||
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees);
|
||||
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees + aPowerUp);
|
||||
bodySprite->setFlip(flipWalk);
|
||||
headSprite->setCurrentAnimation(aWalking + aHeadCoffees + aPowerUp);
|
||||
headSprite->setFlip(flipWalk);
|
||||
}
|
||||
else
|
||||
{ // Está disparando
|
||||
bodySprite->setCurrentAnimation(aFiring + aBodyCoffees);
|
||||
bodySprite->setCurrentAnimation(aFiring + aBodyCoffees + aPowerUp);
|
||||
bodySprite->setFlip(flipFire);
|
||||
headSprite->setCurrentAnimation(aFiring + aHeadCoffees + aPowerUp);
|
||||
headSprite->setFlip(flipFire);
|
||||
@@ -250,6 +264,9 @@ void Player::setAnimation()
|
||||
legsSprite->animate();
|
||||
bodySprite->animate();
|
||||
headSprite->animate();
|
||||
|
||||
fireSprite->animate();
|
||||
fireSprite->setFlip(flipWalk);
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
@@ -588,10 +605,12 @@ void Player::updatePowerUpHeadOffset()
|
||||
if (powerUpCounter % 10 > 4)
|
||||
{
|
||||
// powerUpHeadOffset = 96;
|
||||
fireSprite->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// powerUpHeadOffset = 0;
|
||||
fireSprite->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -604,4 +623,5 @@ void Player::setPlayerTextures(std::vector<LTexture *> texture)
|
||||
bodySprite->setTexture(texture.at(1));
|
||||
legsSprite->setTexture(texture.at(2));
|
||||
deathSprite->setTexture(texture.at(3));
|
||||
fireSprite->setTexture(texture.at(4));
|
||||
}
|
||||
@@ -37,6 +37,7 @@ private:
|
||||
AnimatedSprite *bodySprite; // Sprite para dibujar el cuerpo
|
||||
AnimatedSprite *legsSprite; // Sprite para dibujar las piernas
|
||||
AnimatedSprite *deathSprite; // Sprite para dibujar el jugador derrotado
|
||||
AnimatedSprite *fireSprite; // Sprite para dibujar el aura del jugador con el poder a tope
|
||||
|
||||
// Variables
|
||||
float posX; // Posicion en el eje X
|
||||
|
||||
@@ -13,7 +13,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
||||
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros propios
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
fade = new Fade(renderer);
|
||||
|
||||
@@ -33,6 +33,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
||||
|
||||
menu.title = new Menu(renderer, asset, input, asset->get("title.men"));
|
||||
menu.options = new Menu(renderer, asset, input, asset->get("options.men"));
|
||||
menu.playerSelect = new Menu(renderer, asset, input, asset->get("player_select.men"));
|
||||
|
||||
// Sonidos
|
||||
crashSound = JA_LoadSound(asset->get("title.wav").c_str());
|
||||
@@ -73,6 +74,7 @@ Title::~Title()
|
||||
|
||||
delete menu.title;
|
||||
delete menu.options;
|
||||
delete menu.playerSelect;
|
||||
|
||||
JA_DeleteSound(crashSound);
|
||||
JA_DeleteMusic(titleMusic);
|
||||
@@ -319,14 +321,13 @@ void Title::update()
|
||||
menu.active->update();
|
||||
}
|
||||
|
||||
// Comprueba si se ha seleccionado algún item del menú
|
||||
// Comprueba si se ha seleccionado algún item del menú de titulo
|
||||
if (menu.active->getName() == "TITLE")
|
||||
{
|
||||
switch (menu.active->getItemSelected())
|
||||
{
|
||||
case 0: // 1 PLAYER
|
||||
postFade = 0;
|
||||
fade->activateFade();
|
||||
case 0: // 1 PLAYER -> Cambia al manu de selección de jugador
|
||||
menu.active = menu.playerSelect;
|
||||
break;
|
||||
|
||||
case 1: // 2 PLAYERS
|
||||
@@ -349,6 +350,37 @@ void Title::update()
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba si se ha seleccionado algún item del menú de selección de jugador
|
||||
if (menu.active->getName() == "PLAYER_SELECT")
|
||||
{
|
||||
switch (menu.active->getItemSelected())
|
||||
{
|
||||
case 0:
|
||||
// Este item no se puede seleccionar y actua de titulo
|
||||
break;
|
||||
|
||||
case 1: // BAL1
|
||||
postFade = 0;
|
||||
options->playerSelected = 0;
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
case 2: // AROUNDER
|
||||
postFade = 0;
|
||||
options->playerSelected = 1;
|
||||
fade->activateFade();
|
||||
break;
|
||||
|
||||
case 3: // BACK
|
||||
menu.active = menu.title;
|
||||
menu.playerSelect->reset();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba si se ha seleccionado algún item de opciones
|
||||
if (menu.active->getName() == "OPTIONS")
|
||||
{
|
||||
@@ -873,6 +905,14 @@ void Title::updateMenuLabels()
|
||||
// Recoloca el menu de titulo
|
||||
menu.title->centerMenuOnX(SCREEN_CENTER_X);
|
||||
menu.title->centerMenuElementsOnX();
|
||||
|
||||
// Establece las etiquetas del menu de seleccion de jugador
|
||||
menu.playerSelect->setItemCaption(0, lang->getText(39)); // SELECT PLAYER
|
||||
menu.playerSelect->setItemCaption(3, lang->getText(40)); // BACK
|
||||
|
||||
// Recoloca el menu de selección de jugador
|
||||
menu.playerSelect->centerMenuOnX(SCREEN_CENTER_X);
|
||||
menu.playerSelect->centerMenuElementsOnX();
|
||||
}
|
||||
|
||||
// Aplica las opciones de menu seleccionadas
|
||||
|
||||
@@ -35,10 +35,11 @@ class Title
|
||||
private:
|
||||
struct menu_t
|
||||
{
|
||||
Menu *title; // Menu de la pantalla de título
|
||||
Menu *options; // Menú de la pantalla de opciones
|
||||
Menu *active; // Menu activo (de momento para la pantalla del titulo)
|
||||
bool keyPressed; // Variable para evitar la repetición de teclas en los menus
|
||||
Menu *title; // Menu de la pantalla de título
|
||||
Menu *options; // Menú de la pantalla de opciones
|
||||
Menu *playerSelect; // Menu para elegir jugador
|
||||
Menu *active; // Menu activo (de momento para la pantalla del titulo)
|
||||
bool keyPressed; // Variable para evitar la repetición de teclas en los menus
|
||||
};
|
||||
|
||||
// Objetos
|
||||
|
||||
@@ -87,6 +87,7 @@ struct input_t
|
||||
struct options_t
|
||||
{
|
||||
Uint8 difficulty; // Dificultad del juego
|
||||
Uint8 playerSelected; // Jugador seleccionado para el modo 1P
|
||||
std::vector<input_t> input; // Modo de control (teclado o mando)
|
||||
Uint8 language; // Idioma usado en el juego
|
||||
Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa
|
||||
|
||||
25
todo.txt
@@ -1,25 +0,0 @@
|
||||
x los items se quedan pegados en el techo (comprobar si sigue pasando, he cambiado la coreción al chocar arriba. Si sigue fallando se quita la comprobación superior)
|
||||
x la maquina de cafe no toca el suelo
|
||||
x las bolas verdes nacen naranja al explotarlas
|
||||
falta el aura de superguerrero al pillar la maquina de cafe
|
||||
x la powerball deja la mascara al explotarlas
|
||||
x los menus de pausa y game over falta poner bien los textos
|
||||
x cuando continuas la partida sigues muerto
|
||||
poder elegir el personaje para jugar
|
||||
x arreglar los smart sprites de muerte y de perder el cafe
|
||||
x arreglar los items de las instrucciones
|
||||
x que cicle la musica en el titulo, demo, instrucciones
|
||||
NO que guarde el progreso del juego
|
||||
que aumente la velocidad de las nubes conforme avanzas
|
||||
retocar un poco la distancia entre los cambios de color del cielo, se llega al oscuro muy pronto
|
||||
x las balas deberian llegar a salir de la pantalla
|
||||
x hacer desaparecer los accesos a disco en el juego. cargar todos los recursos previamente y pasarlos por punteros
|
||||
x la powerball se para con el reloj y sigue rodando
|
||||
x acelerar la animacion de disparar recto
|
||||
x no pone la animacion corecta al no disparar con el powerup
|
||||
NO que grite "yiiijaa!" o algo parecido al coger la maquina de cafe
|
||||
NO o que diga DIMONIS! en un globo de texto que se evapore
|
||||
NO podrian salir comentarios aleatoriamente o con ciertos eventos (falta ver si no estorbará)
|
||||
x que se vea el nivel de dificultad
|
||||
poner un dibujito en la pantalla de game over al terminar el juego
|
||||
y quizas otro en la propia pantalla de game over
|
||||