Trabajando en las colisiones con los enemigos

This commit is contained in:
2022-09-23 19:50:40 +02:00
parent eac0236c60
commit 48f84d28bd
21 changed files with 196 additions and 344 deletions

View File

@@ -26,7 +26,7 @@ Text::~Text()
void Text::init()
{
// Inicializa a cero el vector con las coordenadas
for (int i = 0; i < 128; i++)
for (int i = 0; i < 128; ++i)
{
offset[i].x = 0;
offset[i].y = 0;
@@ -44,7 +44,7 @@ void Text::init()
sprite->setSpriteClip(0, 0, sprite->getWidth(), sprite->getHeight());
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
for (int i = 32; i < 128; i++)
for (int i = 32; i < 128; ++i)
{
offset[i].x = ((i - 32) % 15) * boxWidth;
offset[i].y = ((i - 32) / 15) * boxHeight;
@@ -131,7 +131,7 @@ int Text::lenght(std::string text, int kerning)
{
int shift = 0;
for (int i = 0; i < (int)text.length(); i++)
for (int i = 0; i < (int)text.length(); ++i)
shift += (offset[int(text[i])].w + kerning);
// Descuenta el kerning del último caracter