Trabajando en el ending2
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 285 B |
BIN
data/enemies/guitar.png
Normal file
|
After Width: | Height: | Size: 306 B |
|
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 163 B |
@@ -9,8 +9,8 @@ roomLeft=24.room
|
||||
roomRight=0
|
||||
|
||||
[enemy]
|
||||
tileSetFile=wave_v.png
|
||||
animation=wave_v.ani
|
||||
tileSetFile=shock.png
|
||||
animation=shock.ani
|
||||
width=8
|
||||
height=8
|
||||
x=7
|
||||
@@ -25,8 +25,8 @@ color=magenta
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=wave_v.png
|
||||
animation=wave_v.ani
|
||||
tileSetFile=shock.png
|
||||
animation=shock.ani
|
||||
width=8
|
||||
height=8
|
||||
x=20
|
||||
@@ -41,8 +41,8 @@ color=magenta
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=wave_v.png
|
||||
animation=wave_v.ani
|
||||
tileSetFile=shock.png
|
||||
animation=shock.ani
|
||||
width=8
|
||||
height=8
|
||||
x=27
|
||||
|
||||
@@ -25,8 +25,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=wave_v.png
|
||||
animation=wave_v.ani
|
||||
tileSetFile=shock.png
|
||||
animation=shock.ani
|
||||
width=8
|
||||
height=8
|
||||
x=5
|
||||
|
||||
@@ -13,8 +13,8 @@ autoSurface=left
|
||||
|
||||
|
||||
[enemy]
|
||||
tileSetFile=dimallas_v.png
|
||||
animation=dimallas_v.ani
|
||||
tileSetFile=heavy.png
|
||||
animation=heavy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=11
|
||||
@@ -29,8 +29,8 @@ color=green
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=dimallas_v.png
|
||||
animation=dimallas_v.ani
|
||||
tileSetFile=heavy.png
|
||||
animation=heavy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=18
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=red
|
||||
itemColor2=yellow
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_alien.png
|
||||
animation=jailbattle_alien.ani
|
||||
tileSetFile=jb_alien.png
|
||||
animation=jb_alien.ani
|
||||
width=13
|
||||
height=15
|
||||
x=10
|
||||
@@ -28,8 +28,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_alien.png
|
||||
animation=jailbattle_alien.ani
|
||||
tileSetFile=jb_alien.png
|
||||
animation=jb_alien.ani
|
||||
width=13
|
||||
height=15
|
||||
x=25
|
||||
@@ -45,8 +45,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=7
|
||||
@@ -62,8 +62,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=18
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=white
|
||||
itemColor2=green
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=17
|
||||
@@ -28,8 +28,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=2
|
||||
@@ -45,8 +45,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=29
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=bright_white
|
||||
itemColor2=black
|
||||
|
||||
[enemy]
|
||||
tileSetFile=amstrad_character_set.png
|
||||
animation=amstrad_character_set.ani
|
||||
tileSetFile=amstrad_cs.png
|
||||
animation=amstrad_cs.ani
|
||||
width=8
|
||||
height=8
|
||||
x=1
|
||||
@@ -27,8 +27,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=amstrad_character_set.png
|
||||
animation=amstrad_character_set.ani
|
||||
tileSetFile=amstrad_cs.png
|
||||
animation=amstrad_cs.ani
|
||||
width=8
|
||||
height=8
|
||||
x=19
|
||||
@@ -43,8 +43,8 @@ color=yellow
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=amstrad_character_set.png
|
||||
animation=amstrad_character_set.ani
|
||||
tileSetFile=amstrad_cs.png
|
||||
animation=amstrad_cs.ani
|
||||
width=8
|
||||
height=8
|
||||
x=5
|
||||
|
||||
@@ -28,8 +28,8 @@ color=green
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=heavy.png
|
||||
animation=heavy.ani
|
||||
tileSetFile=guitar.png
|
||||
animation=guitar.ani
|
||||
width=16
|
||||
height=16
|
||||
x=16
|
||||
|
||||
@@ -28,8 +28,8 @@ color=green
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=dimallas_v.png
|
||||
animation=dimallas_v.ani
|
||||
tileSetFile=heavy.png
|
||||
animation=heavy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=17
|
||||
@@ -44,8 +44,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=dimallas_v.png
|
||||
animation=dimallas_v.ani
|
||||
tileSetFile=heavy.png
|
||||
animation=heavy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=10
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=red
|
||||
itemColor2=green
|
||||
|
||||
[enemy]
|
||||
tileSetFile=wave_v.png
|
||||
animation=wave_v.ani
|
||||
tileSetFile=shock.png
|
||||
animation=shock.ani
|
||||
width=8
|
||||
height=8
|
||||
x=7
|
||||
@@ -27,8 +27,8 @@ color=yellow
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=wave_v.png
|
||||
animation=wave_v.ani
|
||||
tileSetFile=shock.png
|
||||
animation=shock.ani
|
||||
width=8
|
||||
height=8
|
||||
x=24
|
||||
|
||||
@@ -329,7 +329,7 @@ void Director::loadResources(section_t section)
|
||||
// Enemigos
|
||||
textureList.push_back("abad.png");
|
||||
textureList.push_back("abad_bell.png");
|
||||
textureList.push_back("amstrad_character_set.png");
|
||||
textureList.push_back("amstrad_cs.png");
|
||||
textureList.push_back("arounder_fly.png");
|
||||
textureList.push_back("arounder_stop.png");
|
||||
textureList.push_back("arounder_walk.png");
|
||||
@@ -347,13 +347,13 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("chip.png");
|
||||
textureList.push_back("code.png");
|
||||
textureList.push_back("demon.png");
|
||||
textureList.push_back("dimallas_v.png");
|
||||
textureList.push_back("heavy.png");
|
||||
textureList.push_back("dimallas.png");
|
||||
textureList.push_back("diskette.png");
|
||||
textureList.push_back("dong.png");
|
||||
textureList.push_back("heavy.png");
|
||||
textureList.push_back("jailbattle_alien.png");
|
||||
textureList.push_back("jailbattle_human.png");
|
||||
textureList.push_back("guitar.png");
|
||||
textureList.push_back("jb_alien.png");
|
||||
textureList.push_back("jb_human.png");
|
||||
textureList.push_back("jailer.png");
|
||||
textureList.push_back("jailer2.png");
|
||||
textureList.push_back("jailer3.png");
|
||||
@@ -370,9 +370,12 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("tuno.png");
|
||||
textureList.push_back("tv_panel.png");
|
||||
textureList.push_back("tv.png");
|
||||
textureList.push_back("wave_v.png");
|
||||
textureList.push_back("shock.png");
|
||||
textureList.push_back("wave.png");
|
||||
|
||||
// Player
|
||||
textureList.push_back("player.png");
|
||||
|
||||
resource->loadTextures(textureList);
|
||||
|
||||
// Animaciones
|
||||
@@ -381,7 +384,7 @@ void Director::loadResources(section_t section)
|
||||
// Enemigos
|
||||
animationList.push_back("abad.ani");
|
||||
animationList.push_back("abad_bell.ani");
|
||||
animationList.push_back("amstrad_character_set.ani");
|
||||
animationList.push_back("amstrad_cs.ani");
|
||||
animationList.push_back("arounder_fly.ani");
|
||||
animationList.push_back("arounder_stop.ani");
|
||||
animationList.push_back("arounder_walk.ani");
|
||||
@@ -399,13 +402,13 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("chip.ani");
|
||||
animationList.push_back("code.ani");
|
||||
animationList.push_back("demon.ani");
|
||||
animationList.push_back("dimallas_v.ani");
|
||||
animationList.push_back("heavy.ani");
|
||||
animationList.push_back("dimallas.ani");
|
||||
animationList.push_back("diskette.ani");
|
||||
animationList.push_back("dong.ani");
|
||||
animationList.push_back("heavy.ani");
|
||||
animationList.push_back("jailbattle_alien.ani");
|
||||
animationList.push_back("jailbattle_human.ani");
|
||||
animationList.push_back("guitar.ani");
|
||||
animationList.push_back("jb_alien.ani");
|
||||
animationList.push_back("jb_human.ani");
|
||||
animationList.push_back("jailer.ani");
|
||||
animationList.push_back("jailer2.ani");
|
||||
animationList.push_back("jailer3.ani");
|
||||
@@ -422,9 +425,12 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("tuno.ani");
|
||||
animationList.push_back("tv_panel.ani");
|
||||
animationList.push_back("tv.ani");
|
||||
animationList.push_back("wave_v.ani");
|
||||
animationList.push_back("shock.ani");
|
||||
animationList.push_back("wave.ani");
|
||||
|
||||
// Player
|
||||
animationList.push_back("player.ani");
|
||||
|
||||
resource->loadAnimations(animationList);
|
||||
|
||||
// Offsets
|
||||
@@ -458,7 +464,7 @@ void Director::loadResources(section_t section)
|
||||
// Enemigos
|
||||
textureList.push_back("abad.png");
|
||||
textureList.push_back("abad_bell.png");
|
||||
textureList.push_back("amstrad_character_set.png");
|
||||
textureList.push_back("amstrad_cs.png");
|
||||
textureList.push_back("arounder_fly.png");
|
||||
textureList.push_back("arounder_stop.png");
|
||||
textureList.push_back("arounder_walk.png");
|
||||
@@ -476,13 +482,13 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("chip.png");
|
||||
textureList.push_back("code.png");
|
||||
textureList.push_back("demon.png");
|
||||
textureList.push_back("dimallas_v.png");
|
||||
textureList.push_back("heavy.png");
|
||||
textureList.push_back("dimallas.png");
|
||||
textureList.push_back("diskette.png");
|
||||
textureList.push_back("dong.png");
|
||||
textureList.push_back("heavy.png");
|
||||
textureList.push_back("jailbattle_alien.png");
|
||||
textureList.push_back("jailbattle_human.png");
|
||||
textureList.push_back("guitar.png");
|
||||
textureList.push_back("jb_alien.png");
|
||||
textureList.push_back("jb_human.png");
|
||||
textureList.push_back("jailer.png");
|
||||
textureList.push_back("jailer2.png");
|
||||
textureList.push_back("jailer3.png");
|
||||
@@ -499,7 +505,7 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("tuno.png");
|
||||
textureList.push_back("tv_panel.png");
|
||||
textureList.push_back("tv.png");
|
||||
textureList.push_back("wave_v.png");
|
||||
textureList.push_back("shock.png");
|
||||
textureList.push_back("wave.png");
|
||||
|
||||
// Items
|
||||
@@ -520,7 +526,7 @@ void Director::loadResources(section_t section)
|
||||
// Enemigos
|
||||
animationList.push_back("abad.ani");
|
||||
animationList.push_back("abad_bell.ani");
|
||||
animationList.push_back("amstrad_character_set.ani");
|
||||
animationList.push_back("amstrad_cs.ani");
|
||||
animationList.push_back("arounder_fly.ani");
|
||||
animationList.push_back("arounder_stop.ani");
|
||||
animationList.push_back("arounder_walk.ani");
|
||||
@@ -538,13 +544,13 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("chip.ani");
|
||||
animationList.push_back("code.ani");
|
||||
animationList.push_back("demon.ani");
|
||||
animationList.push_back("dimallas_v.ani");
|
||||
animationList.push_back("heavy.ani");
|
||||
animationList.push_back("dimallas.ani");
|
||||
animationList.push_back("diskette.ani");
|
||||
animationList.push_back("dong.ani");
|
||||
animationList.push_back("heavy.ani");
|
||||
animationList.push_back("jailbattle_alien.ani");
|
||||
animationList.push_back("jailbattle_human.ani");
|
||||
animationList.push_back("guitar.ani");
|
||||
animationList.push_back("jb_alien.ani");
|
||||
animationList.push_back("jb_human.ani");
|
||||
animationList.push_back("jailer.ani");
|
||||
animationList.push_back("jailer2.ani");
|
||||
animationList.push_back("jailer3.ani");
|
||||
@@ -561,7 +567,7 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("tuno.ani");
|
||||
animationList.push_back("tv_panel.ani");
|
||||
animationList.push_back("tv.ani");
|
||||
animationList.push_back("wave_v.ani");
|
||||
animationList.push_back("shock.ani");
|
||||
animationList.push_back("wave.ani");
|
||||
|
||||
resource->loadAnimations(animationList);
|
||||
@@ -1073,8 +1079,8 @@ bool Director::setFileList()
|
||||
asset->add("/data/enemies/abad_bell.png", t_bitmap);
|
||||
asset->add("/data/enemies/abad.ani", t_data);
|
||||
asset->add("/data/enemies/abad.png", t_bitmap);
|
||||
asset->add("/data/enemies/amstrad_character_set.ani", t_data);
|
||||
asset->add("/data/enemies/amstrad_character_set.png", t_bitmap);
|
||||
asset->add("/data/enemies/amstrad_cs.ani", t_data);
|
||||
asset->add("/data/enemies/amstrad_cs.png", t_bitmap);
|
||||
asset->add("/data/enemies/arounder_fly.ani", t_data);
|
||||
asset->add("/data/enemies/arounder_fly.png", t_bitmap);
|
||||
asset->add("/data/enemies/arounder_stop.ani", t_data);
|
||||
@@ -1109,20 +1115,20 @@ bool Director::setFileList()
|
||||
asset->add("/data/enemies/code.png", t_bitmap);
|
||||
asset->add("/data/enemies/demon.ani", t_data);
|
||||
asset->add("/data/enemies/demon.png", t_bitmap);
|
||||
asset->add("/data/enemies/dimallas_v.ani", t_data);
|
||||
asset->add("/data/enemies/dimallas_v.png", t_bitmap);
|
||||
asset->add("/data/enemies/heavy.ani", t_data);
|
||||
asset->add("/data/enemies/heavy.png", t_bitmap);
|
||||
asset->add("/data/enemies/dimallas.ani", t_data);
|
||||
asset->add("/data/enemies/dimallas.png", t_bitmap);
|
||||
asset->add("/data/enemies/diskette.ani", t_data);
|
||||
asset->add("/data/enemies/diskette.png", t_bitmap);
|
||||
asset->add("/data/enemies/dong.ani", t_data);
|
||||
asset->add("/data/enemies/dong.png", t_bitmap);
|
||||
asset->add("/data/enemies/heavy.ani", t_data);
|
||||
asset->add("/data/enemies/heavy.png", t_bitmap);
|
||||
asset->add("/data/enemies/jailbattle_alien.ani", t_data);
|
||||
asset->add("/data/enemies/jailbattle_alien.png", t_bitmap);
|
||||
asset->add("/data/enemies/jailbattle_human.ani", t_data);
|
||||
asset->add("/data/enemies/jailbattle_human.png", t_bitmap);
|
||||
asset->add("/data/enemies/guitar.ani", t_data);
|
||||
asset->add("/data/enemies/guitar.png", t_bitmap);
|
||||
asset->add("/data/enemies/jb_alien.ani", t_data);
|
||||
asset->add("/data/enemies/jb_alien.png", t_bitmap);
|
||||
asset->add("/data/enemies/jb_human.ani", t_data);
|
||||
asset->add("/data/enemies/jb_human.png", t_bitmap);
|
||||
asset->add("/data/enemies/jailer.ani", t_data);
|
||||
asset->add("/data/enemies/jailer.png", t_bitmap);
|
||||
asset->add("/data/enemies/jailer2.ani", t_data);
|
||||
@@ -1155,8 +1161,8 @@ bool Director::setFileList()
|
||||
asset->add("/data/enemies/tv_panel.png", t_bitmap);
|
||||
asset->add("/data/enemies/tv.ani", t_data);
|
||||
asset->add("/data/enemies/tv.png", t_bitmap);
|
||||
asset->add("/data/enemies/wave_v.ani", t_data);
|
||||
asset->add("/data/enemies/wave_v.png", t_bitmap);
|
||||
asset->add("/data/enemies/shock.ani", t_data);
|
||||
asset->add("/data/enemies/shock.png", t_bitmap);
|
||||
asset->add("/data/enemies/wave.ani", t_data);
|
||||
asset->add("/data/enemies/wave.png", t_bitmap);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ending2.h"
|
||||
#include <algorithm>
|
||||
|
||||
// Constructor
|
||||
Ending2::Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||
@@ -24,7 +25,9 @@ Ending2::Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
||||
ticksSpeed = 15;
|
||||
distSpriteText = 8;
|
||||
distSpriteSprite = 0;
|
||||
despSpeed = -0.2f;
|
||||
despSpeed = -1.6f;
|
||||
firstCol = GAMECANVAS_FIRST_QUARTER_X + (GAMECANVAS_WIDTH / 16);
|
||||
secondCol = GAMECANVAS_THIRD_QUARTER_X - (GAMECANVAS_WIDTH / 16);
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "black"));
|
||||
@@ -40,6 +43,9 @@ Ending2::Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
||||
|
||||
// Crea los sprites con las texturas con los textos
|
||||
createSpriteTexts();
|
||||
|
||||
// Crea los sprites con las texturas con los textos del final
|
||||
createTexts();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -52,6 +58,7 @@ Ending2::~Ending2()
|
||||
|
||||
deleteSprites();
|
||||
deleteSpriteTexts();
|
||||
deleteTexts();
|
||||
}
|
||||
|
||||
// Actualiza el objeto
|
||||
@@ -74,6 +81,9 @@ void Ending2::update()
|
||||
|
||||
// Actualiza los sprites de texto
|
||||
updateTextSprites();
|
||||
|
||||
// Actualiza los sprites de texto del final
|
||||
updateTexts();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +102,9 @@ void Ending2::render()
|
||||
// Dibuja los sprites con el texto
|
||||
renderSpriteTexts();
|
||||
|
||||
// Dibuja los sprites con el texto del final
|
||||
renderTexts();
|
||||
|
||||
const std::string txt = std::to_string(preCounter) + " - " + std::to_string(counter) + " - W:" + std::to_string(maxSpriteWidth) + " - H:" + std::to_string(maxSpriteHeight);
|
||||
// text->write(0, 192 - 8, txt);
|
||||
|
||||
@@ -110,11 +123,31 @@ void Ending2::render()
|
||||
}
|
||||
}*/
|
||||
|
||||
/*{
|
||||
SDL_SetRenderDrawColor(renderer, 128, 128, 128, 128);
|
||||
SDL_RenderDrawLine(renderer, GAMECANVAS_FIRST_QUARTER_X, 0, GAMECANVAS_FIRST_QUARTER_X, 192);
|
||||
SDL_RenderDrawLine(renderer, GAMECANVAS_THIRD_QUARTER_X, 0, GAMECANVAS_THIRD_QUARTER_X, 192);
|
||||
}*/
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
||||
for (int i = 0; i < 256; i += 2)
|
||||
{
|
||||
SDL_RenderDrawPoint(renderer, i + 0, 0);
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 1);
|
||||
SDL_RenderDrawPoint(renderer, i + 0, 2);
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 3);
|
||||
|
||||
SDL_RenderDrawPoint(renderer, i, 4);
|
||||
SDL_RenderDrawPoint(renderer, i, 6);
|
||||
|
||||
SDL_RenderDrawPoint(renderer, i + 0, 191);
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 190);
|
||||
SDL_RenderDrawPoint(renderer, i + 0, 189);
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 188);
|
||||
|
||||
SDL_RenderDrawPoint(renderer, i, 187);
|
||||
SDL_RenderDrawPoint(renderer, i, 185);
|
||||
}
|
||||
// SDL_RenderDrawLine(renderer, 0, 1, 255, 1);
|
||||
// SDL_RenderDrawLine(renderer, 0, 3, 255, 3);
|
||||
// SDL_RenderDrawLine(renderer, 0, 188, 255, 188);
|
||||
// SDL_RenderDrawLine(renderer, 0, 190, 255, 190);
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
@@ -203,7 +236,7 @@ section_t Ending2::run()
|
||||
void Ending2::updateCounters()
|
||||
{
|
||||
// Incrementa el contador
|
||||
if (preCounter < 20)
|
||||
if (preCounter < 100)
|
||||
{
|
||||
preCounter++;
|
||||
}
|
||||
@@ -222,7 +255,7 @@ void Ending2::iniSpriteList()
|
||||
// Añade los valores
|
||||
spriteList.push_back("abad");
|
||||
spriteList.push_back("abad_bell");
|
||||
spriteList.push_back("amstrad_character_set");
|
||||
spriteList.push_back("amstrad_cs");
|
||||
spriteList.push_back("arounder_fly");
|
||||
spriteList.push_back("arounder_stop");
|
||||
spriteList.push_back("arounder_walk");
|
||||
@@ -240,13 +273,13 @@ void Ending2::iniSpriteList()
|
||||
spriteList.push_back("chip");
|
||||
spriteList.push_back("code");
|
||||
spriteList.push_back("demon");
|
||||
spriteList.push_back("dimallas_v");
|
||||
spriteList.push_back("heavy");
|
||||
spriteList.push_back("dimallas");
|
||||
spriteList.push_back("diskette");
|
||||
spriteList.push_back("dong");
|
||||
spriteList.push_back("heavy");
|
||||
spriteList.push_back("jailbattle_alien");
|
||||
spriteList.push_back("jailbattle_human");
|
||||
spriteList.push_back("guitar");
|
||||
spriteList.push_back("jb_alien");
|
||||
spriteList.push_back("jb_human");
|
||||
spriteList.push_back("jailer");
|
||||
spriteList.push_back("jailer2");
|
||||
spriteList.push_back("jailer3");
|
||||
@@ -263,8 +296,10 @@ void Ending2::iniSpriteList()
|
||||
spriteList.push_back("tuno");
|
||||
spriteList.push_back("tv_panel");
|
||||
spriteList.push_back("tv");
|
||||
spriteList.push_back("wave_v");
|
||||
spriteList.push_back("shock");
|
||||
spriteList.push_back("wave");
|
||||
|
||||
spriteList.push_back("player");
|
||||
}
|
||||
|
||||
// Carga todos los sprites desde una lista
|
||||
@@ -289,7 +324,7 @@ void Ending2::loadSprites()
|
||||
// Actualiza los sprites
|
||||
void Ending2::updateSprites()
|
||||
{
|
||||
for (auto &sprite : sprites)
|
||||
for (auto sprite : sprites)
|
||||
{
|
||||
sprite->update();
|
||||
}
|
||||
@@ -298,12 +333,24 @@ void Ending2::updateSprites()
|
||||
// Actualiza los sprites de texto
|
||||
void Ending2::updateTextSprites()
|
||||
{
|
||||
for (auto &sprite : spriteTexts)
|
||||
for (auto sprite : spriteTexts)
|
||||
{
|
||||
sprite->update();
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza los sprites de texto del final
|
||||
void Ending2::updateTexts()
|
||||
{
|
||||
for (auto sprite : texts)
|
||||
{
|
||||
if (sprite->getPosY() > GAMECANVAS_CENTER_Y)
|
||||
{
|
||||
sprite->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja los sprites
|
||||
void Ending2::renderSprites()
|
||||
{
|
||||
@@ -319,6 +366,12 @@ void Ending2::renderSprites()
|
||||
sprite->getTexture()->setColor(255, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
// Pinta el ultimo elemento de otro color
|
||||
const color_t c = stringToColor(options->palette, "white");
|
||||
sprites.back()->getTexture()->setColor(c.r, c.g, c.b);
|
||||
sprites.back()->render();
|
||||
sprites.back()->getTexture()->setColor(255, 255, 255);
|
||||
}
|
||||
|
||||
// Dibuja los sprites con el texto
|
||||
@@ -338,13 +391,29 @@ void Ending2::renderSpriteTexts()
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja los sprites con el texto del final
|
||||
void Ending2::renderTexts()
|
||||
{
|
||||
const color_t color = stringToColor(options->palette, "white");
|
||||
for (auto sprite : texts)
|
||||
{
|
||||
const bool a = sprite->getRect().y + sprite->getRect().h > 0;
|
||||
const bool b = sprite->getRect().y < GAMECANVAS_HEIGHT;
|
||||
if (a && b)
|
||||
{
|
||||
sprite->getTexture()->setColor(color.r, color.g, color.b);
|
||||
sprite->render();
|
||||
sprite->getTexture()->setColor(255, 255, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Coloca los sprites en su sito
|
||||
void Ending2::placeSprites()
|
||||
{
|
||||
const int sep = 16;
|
||||
for (int i = 0; i < (int)sprites.size(); ++i)
|
||||
{
|
||||
const int x = i % 2 == 0 ? GAMECANVAS_FIRST_QUARTER_X : GAMECANVAS_THIRD_QUARTER_X;
|
||||
const int x = i % 2 == 0 ? firstCol : secondCol;
|
||||
const int y = (i / 1) * (maxSpriteHeight + distSpriteText + text->getCharacterSize() + distSpriteSprite) + GAMECANVAS_HEIGHT;
|
||||
const int w = sprites.at(i)->getAnimationClip(0, 0).w;
|
||||
const int h = sprites.at(i)->getAnimationClip(0, 0).h;
|
||||
@@ -354,6 +423,14 @@ void Ending2::placeSprites()
|
||||
sprites.at(i)->setRect({x + dx, y + dy, w, h});
|
||||
sprites.at(i)->setVelY(despSpeed);
|
||||
}
|
||||
|
||||
// Recoloca el último sprite, que es el del jugador
|
||||
const int w = sprites.back()->getAnimationClip(0, 0).w;
|
||||
const int x = GAMECANVAS_CENTER_X - (w / 2);
|
||||
const int y = sprites.back()->getPosY() + maxSpriteHeight * 2;
|
||||
sprites.back()->setPosX(x);
|
||||
sprites.back()->setPosY(y);
|
||||
sprites.back()->setCurrentAnimation("walk");
|
||||
}
|
||||
|
||||
// Crea los sprites con las texturas con los textos
|
||||
@@ -366,30 +443,62 @@ void Ending2::createSpriteTexts()
|
||||
for (int i = 0; i < (int)spriteList.size(); ++i)
|
||||
{
|
||||
// Calcula constantes
|
||||
// Texto debajo
|
||||
const int w = text->lenght(spriteList.at(i), 1);
|
||||
std::string txt = spriteList.at(i);
|
||||
std::replace(txt.begin(), txt.end(), '_', ' ');
|
||||
txt = txt == "player" ? "JAILDOCTOR" : txt; // Reemplaza el texto
|
||||
const int w = text->lenght(txt, 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = i % 2 == 0 ? GAMECANVAS_FIRST_QUARTER_X : GAMECANVAS_THIRD_QUARTER_X;
|
||||
const int x = i % 2 == 0 ? firstCol : secondCol;
|
||||
const int dx = -(w / 2);
|
||||
const int y = sprites.at(i)->getPosY() + sprites.at(i)->getHeight() + distSpriteText;
|
||||
|
||||
// Texto al lado
|
||||
// const int w = text->lenght(spriteList.at(i), 1);
|
||||
// const int h = text->getCharacterSize();
|
||||
// const int x = i % 2 == 1 ? GAMECANVAS_FIRST_QUARTER_X : GAMECANVAS_THIRD_QUARTER_X;
|
||||
// const int dx = -(w / 2);
|
||||
// const int y = sprites.at(i)->getPosY() + (sprites.at(i)->getHeight() / 2) - (h / 2);
|
||||
// Cambia la posición del último sprite
|
||||
const int X = (i == (int)spriteList.size() - 1) ? GAMECANVAS_CENTER_X - (w / 2) : x + dx;
|
||||
|
||||
// Crea la textura
|
||||
Texture *texture = new Texture(renderer);
|
||||
texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET);
|
||||
texture->setAsRenderTarget(renderer);
|
||||
texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
text->write(0, 0, spriteList.at(i));
|
||||
text->write(0, 0, txt);
|
||||
|
||||
// Crea el sprite
|
||||
MovingSprite *sprite = new MovingSprite(X, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer);
|
||||
spriteTexts.push_back(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
// Crea los sprites con las texturas con los textos del final
|
||||
void Ending2::createTexts()
|
||||
{
|
||||
// Borra la memoria ocupada por los sprites con las texturas de los textos del final
|
||||
deleteTexts();
|
||||
|
||||
const int start = spriteTexts.back()->getPosY() + text->getCharacterSize() * 6;
|
||||
std::vector<std::string> list;
|
||||
list.push_back("THANK YOU");
|
||||
list.push_back("FOR PLAYING!");
|
||||
|
||||
// Crea los sprites de texto a partir de la lista
|
||||
for (int i = 0; i < (int)list.size(); ++i)
|
||||
{
|
||||
// Calcula constantes
|
||||
const int w = text->lenght(list.at(i), 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = GAMECANVAS_CENTER_X;
|
||||
const int dx = -(w / 2);
|
||||
const int y = start + (text->getCharacterSize() * (i * 2));
|
||||
|
||||
// Crea la textura
|
||||
Texture *texture = new Texture(renderer);
|
||||
texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET);
|
||||
texture->setAsRenderTarget(renderer);
|
||||
texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
text->write(0, 0, list.at(i));
|
||||
|
||||
// Crea el sprite
|
||||
MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer);
|
||||
spriteTexts.push_back(sprite);
|
||||
texts.push_back(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,3 +522,13 @@ void Ending2::deleteSprites()
|
||||
}
|
||||
sprites.clear();
|
||||
}
|
||||
|
||||
// Borra la memoria ocupada por los sprites con las texturas de los textos del final
|
||||
void Ending2::deleteTexts()
|
||||
{
|
||||
for (auto text : texts)
|
||||
{
|
||||
delete text;
|
||||
}
|
||||
texts.clear();
|
||||
}
|
||||
@@ -28,7 +28,8 @@ private:
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
std::vector<AnimatedSprite *> sprites; // Vector con todos los sprites a dibujar
|
||||
std::vector<MovingSprite *> spriteTexts; // Vector con los sprites de texto
|
||||
std::vector<MovingSprite *> spriteTexts; // Vector con los sprites de texto de los sprites
|
||||
std::vector<MovingSprite *> texts; // Vector con los sprites de texto
|
||||
|
||||
// Variables
|
||||
int counter; // Contador
|
||||
@@ -43,6 +44,8 @@ private:
|
||||
int distSpriteText; // Distancia entre el sprite y el texto que lo acompaña
|
||||
int distSpriteSprite; // Distancia entre dos sprites de la misma columna
|
||||
float despSpeed; // Velocidad de desplazamiento de los sprites
|
||||
int firstCol; // Primera columna por donde desfilan los sprites
|
||||
int secondCol; // Segunda columna por donde desfilan los sprites
|
||||
|
||||
// Actualiza el objeto
|
||||
void update();
|
||||
@@ -68,24 +71,36 @@ private:
|
||||
// Actualiza los sprites de texto
|
||||
void updateTextSprites();
|
||||
|
||||
// Actualiza los sprites de texto del final
|
||||
void updateTexts();
|
||||
|
||||
// Dibuja los sprites
|
||||
void renderSprites();
|
||||
|
||||
// Dibuja los sprites con el texto
|
||||
void renderSpriteTexts();
|
||||
|
||||
// Dibuja los sprites con el texto del final
|
||||
void renderTexts();
|
||||
|
||||
// Coloca los sprites en su sito
|
||||
void placeSprites();
|
||||
|
||||
// Crea los sprites con las texturas con los textos
|
||||
void createSpriteTexts();
|
||||
|
||||
// Crea los sprites con las texturas con los textos del final
|
||||
void createTexts();
|
||||
|
||||
// Borra la memoria ocupada por los sprites con las texturas de los textos
|
||||
void deleteSpriteTexts();
|
||||
|
||||
// Borra la memoria ocupada por los sprites
|
||||
void deleteSprites();
|
||||
|
||||
// Borra la memoria ocupada por los sprites con las texturas de los textos del final
|
||||
void deleteTexts();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options);
|
||||
|
||||