forked from jaildesigner-jailgames/jaildoctors_dilemma
Sonidos de saltar, caer y morir
This commit is contained in:
@@ -12,8 +12,8 @@ roomRight=02.room
|
|||||||
[/tilemap]
|
[/tilemap]
|
||||||
|
|
||||||
[enemy]
|
[enemy]
|
||||||
tileset=paco.png
|
tileset=diskette.png
|
||||||
animation=paco.ani
|
animation=diskette.ani
|
||||||
width=16
|
width=16
|
||||||
height=16
|
height=16
|
||||||
x=1
|
x=1
|
||||||
@@ -28,8 +28,8 @@ color=red
|
|||||||
[/enemy]
|
[/enemy]
|
||||||
|
|
||||||
[enemy]
|
[enemy]
|
||||||
tileset=paco.png
|
tileset=diskette.png
|
||||||
animation=paco.ani
|
animation=diskette.ani
|
||||||
width=16
|
width=16
|
||||||
height=16
|
height=16
|
||||||
x=5
|
x=5
|
||||||
@@ -45,7 +45,7 @@ color=yellow
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=1
|
x=1
|
||||||
y=7
|
y=7
|
||||||
counter=6
|
counter=6
|
||||||
@@ -53,7 +53,7 @@ counter=6
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=17
|
x=17
|
||||||
y=8
|
y=8
|
||||||
counter=7
|
counter=7
|
||||||
@@ -63,7 +63,7 @@ counter=7
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=12
|
x=12
|
||||||
y=12
|
y=12
|
||||||
counter=1
|
counter=1
|
||||||
@@ -71,7 +71,7 @@ counter=1
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=13
|
x=13
|
||||||
y=12
|
y=12
|
||||||
counter=2
|
counter=2
|
||||||
@@ -79,7 +79,7 @@ counter=2
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=14
|
x=14
|
||||||
y=12
|
y=12
|
||||||
counter=3
|
counter=3
|
||||||
@@ -87,7 +87,7 @@ counter=3
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=15
|
x=15
|
||||||
y=12
|
y=12
|
||||||
counter=4
|
counter=4
|
||||||
@@ -95,7 +95,7 @@ counter=4
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
tileset=items.png
|
tileset=items.png
|
||||||
tile=0
|
tile=1
|
||||||
x=16
|
x=16
|
||||||
y=12
|
y=12
|
||||||
counter=5
|
counter=5
|
||||||
|
|||||||
10
media/enemies/diskette.ani
Normal file
10
media/enemies/diskette.ani
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
frames_per_row=4
|
||||||
|
frame_width=16
|
||||||
|
frame_height=16
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
name=default
|
||||||
|
speed=8
|
||||||
|
loop=0
|
||||||
|
frames=0,1,2,3
|
||||||
|
[/animation]
|
||||||
BIN
media/enemies/diskette.png
Normal file
BIN
media/enemies/diskette.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 271 B |
Binary file not shown.
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 579 B |
@@ -184,6 +184,8 @@ bool Director::setFileList()
|
|||||||
asset->add("/media/enemies/wave.ani", data);
|
asset->add("/media/enemies/wave.ani", data);
|
||||||
asset->add("/media/enemies/sigmasua.png", bitmap);
|
asset->add("/media/enemies/sigmasua.png", bitmap);
|
||||||
asset->add("/media/enemies/sigmasua.ani", data);
|
asset->add("/media/enemies/sigmasua.ani", data);
|
||||||
|
asset->add("/media/enemies/diskette.png", bitmap);
|
||||||
|
asset->add("/media/enemies/diskette.ani", data);
|
||||||
|
|
||||||
asset->add("/media/player/player.png", bitmap);
|
asset->add("/media/player/player.png", bitmap);
|
||||||
asset->add("/media/player/player.ani", data);
|
asset->add("/media/player/player.ani", data);
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ void Game::checkEventHandler()
|
|||||||
}
|
}
|
||||||
else if ((eventHandler->type == SDL_KEYDOWN) and (eventHandler->key.repeat == 0))
|
else if ((eventHandler->type == SDL_KEYDOWN) and (eventHandler->key.repeat == 0))
|
||||||
{
|
{
|
||||||
//test->update();
|
|
||||||
|
|
||||||
switch (eventHandler->key.keysym.scancode)
|
switch (eventHandler->key.keysym.scancode)
|
||||||
{
|
{
|
||||||
case SDL_SCANCODE_ESCAPE:
|
case SDL_SCANCODE_ESCAPE:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Ren
|
|||||||
border = BORDER_TOP;
|
border = BORDER_TOP;
|
||||||
invincible = false;
|
invincible = false;
|
||||||
|
|
||||||
jump_ini = ini.jump_ini;
|
jumpIni = ini.jumpIni;
|
||||||
state = ini.state;
|
state = ini.state;
|
||||||
prevState = state;
|
prevState = state;
|
||||||
|
|
||||||
@@ -74,7 +74,24 @@ Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Ren
|
|||||||
jumpSound.push_back(JA_LoadSound(asset->get("jump23.wav").c_str()));
|
jumpSound.push_back(JA_LoadSound(asset->get("jump23.wav").c_str()));
|
||||||
jumpSound.push_back(JA_LoadSound(asset->get("jump24.wav").c_str()));
|
jumpSound.push_back(JA_LoadSound(asset->get("jump24.wav").c_str()));
|
||||||
|
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump11.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump12.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump13.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump14.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump15.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump16.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump17.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump18.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump19.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump20.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump21.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump22.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump23.wav").c_str()));
|
||||||
|
fallSound.push_back(JA_LoadSound(asset->get("jump24.wav").c_str()));
|
||||||
|
|
||||||
r = {0, 0, 0, 0};
|
r = {0, 0, 0, 0};
|
||||||
|
jumpCounter = 0;
|
||||||
|
fallCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@@ -153,8 +170,8 @@ void Player::checkInput()
|
|||||||
{
|
{
|
||||||
setState(s_jumping);
|
setState(s_jumping);
|
||||||
vy = -maxVY;
|
vy = -maxVY;
|
||||||
jump_ini = y;
|
jumpIni = y;
|
||||||
JA_PlaySound(jumpSound[0]);
|
jumpCounter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,11 +224,21 @@ void Player::checkState()
|
|||||||
{
|
{
|
||||||
vx = 0.0f;
|
vx = 0.0f;
|
||||||
vy = maxVY;
|
vy = maxVY;
|
||||||
|
fallCounter++;
|
||||||
|
playFallSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (state == s_standing)
|
else if (state == s_standing)
|
||||||
{
|
{
|
||||||
vy = 0.0f;
|
vy = 0.0f;
|
||||||
|
jumpCounter = 0;
|
||||||
|
fallCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (state == s_jumping)
|
||||||
|
{
|
||||||
|
jumpCounter++;
|
||||||
|
playJumpSound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +248,7 @@ void Player::switchBorders()
|
|||||||
if (border == BORDER_TOP)
|
if (border == BORDER_TOP)
|
||||||
{
|
{
|
||||||
y = PLAY_AREA_BOTTOM - h - 1;
|
y = PLAY_AREA_BOTTOM - h - 1;
|
||||||
jump_ini += 128;
|
jumpIni += 128;
|
||||||
}
|
}
|
||||||
else if (border == BORDER_BOTTOM)
|
else if (border == BORDER_BOTTOM)
|
||||||
{
|
{
|
||||||
@@ -424,147 +451,6 @@ void Player::move()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
|
|
||||||
// Calcula la nueva posición del jugador y compensa en caso de colisión
|
|
||||||
/*x += vx;
|
|
||||||
|
|
||||||
// Comprueba colisiones con muros
|
|
||||||
if (checkWalls())
|
|
||||||
{
|
|
||||||
// Recoloca
|
|
||||||
if (vx > 0.0f)
|
|
||||||
{
|
|
||||||
x = (int)x - ((int)x + w) % tileSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = (int)x + tileSize - ((int)x % tileSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba colisiones con rampas solo si esta quieto o cayendo
|
|
||||||
else if (vy >= 0.0f)
|
|
||||||
{
|
|
||||||
|
|
||||||
tile_e slope = checkSlopes();
|
|
||||||
tile_e slope2 = checkSlopes2();
|
|
||||||
debug->add("SLOPE = " + std::to_string(slope));
|
|
||||||
debug->add("SLOPE2 = " + std::to_string(slope2));
|
|
||||||
if (slope != t_empty)
|
|
||||||
{ // Cuesta hacia la derecha
|
|
||||||
if (slope == t_slope_r)
|
|
||||||
{ // Recoloca
|
|
||||||
y = -h + room->getSlopeHeight(feet[1], t_slope_r);
|
|
||||||
debug->add("feet[1] = " + std::to_string(feet[1].y));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cuesta hacia la izquierda
|
|
||||||
if (slope == t_slope_l)
|
|
||||||
{ // Recoloca
|
|
||||||
y = -h + room->getSlopeHeight(feet[0], t_slope_l);
|
|
||||||
debug->add("feet[0] = " + std::to_string(feet[0].y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (slope2 != t_empty)
|
|
||||||
{ // Cuesta hacia la derecha
|
|
||||||
if (slope2 == t_slope_r)
|
|
||||||
{ // Recoloca
|
|
||||||
y = -h + room->getSlopeHeight(underFeet[1], t_slope_r);
|
|
||||||
debug->add("ufeet[1] = " + std::to_string(underFeet[1].y));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cuesta hacia la izquierda
|
|
||||||
if (slope2 == t_slope_l)
|
|
||||||
{ // Recoloca
|
|
||||||
y = -h + room->getSlopeHeight(underFeet[0], t_slope_l);
|
|
||||||
debug->add("ufeet[0] = " + std::to_string(underFeet[0].y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
y += vy;
|
|
||||||
if (checkWalls())
|
|
||||||
{
|
|
||||||
// Recoloca
|
|
||||||
if (vy > 0.0f)
|
|
||||||
{ // Bajando
|
|
||||||
y -= ((int)y + h) % tileSize;
|
|
||||||
setState(s_standing);
|
|
||||||
vy = 0.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Subiendo
|
|
||||||
y += tileSize - ((int)y % tileSize);
|
|
||||||
setState(s_falling);
|
|
||||||
vy = maxVY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// Si no colisiona con los muros, haz comprobaciones extra
|
|
||||||
{
|
|
||||||
const int a = (lastPosition.y + h - 1) / tileSize;
|
|
||||||
const int b = ((int)y + h - 1) / tileSize;
|
|
||||||
const bool tile_change = a != b;
|
|
||||||
|
|
||||||
bool going_down = vy >= 0.0f;
|
|
||||||
bool tile_aligned = ((int)y + h) % tileSize == 0;
|
|
||||||
|
|
||||||
// Si está cayendo y hay cambio de tile o está justo sobre uno
|
|
||||||
if (going_down && (tile_aligned || tile_change))
|
|
||||||
{
|
|
||||||
// Comprueba si tiene uno de los pies sobre una superficie
|
|
||||||
if (isOnFloor())
|
|
||||||
{ // Y deja al jugador de pie
|
|
||||||
setState(s_standing);
|
|
||||||
vy = 0.0f;
|
|
||||||
|
|
||||||
// Si ademas ha habido un cambio de tile recoloca al jugador
|
|
||||||
if (tile_change && !checkSlopes2())
|
|
||||||
{
|
|
||||||
y = ((int)y - ((int)y % tileSize));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si tiene ambos pies sobre el vacío y no está saltando
|
|
||||||
else if (state != s_jumping)
|
|
||||||
{
|
|
||||||
setState(s_falling);
|
|
||||||
vy = maxVY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
going_down = vy >= 0.0f;
|
|
||||||
tile_aligned = ((int)y + h) % tileSize == 0;
|
|
||||||
|
|
||||||
// Si simplemente está cayendo (sin mirar si hay cambio de tile o si está justo sobre uno)
|
|
||||||
if (going_down)
|
|
||||||
{
|
|
||||||
if (state != s_jumping)
|
|
||||||
{
|
|
||||||
setState(s_falling);
|
|
||||||
vy = maxVY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si está alineado con el tile mira el suelo (para que no lo mire si está
|
|
||||||
// dentro de un tile atravesable y lo deje a medias)
|
|
||||||
if (tile_aligned)
|
|
||||||
{
|
|
||||||
if (isOnFloor())
|
|
||||||
{
|
|
||||||
setState(s_standing);
|
|
||||||
vy = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// EXPERIMENTAL
|
|
||||||
else if (checkSlopes())
|
|
||||||
{
|
|
||||||
setState(s_standing);
|
|
||||||
vy = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Actualiza la posición del sprite
|
// Actualiza la posición del sprite
|
||||||
sprite->setPosX(x);
|
sprite->setPosX(x);
|
||||||
sprite->setPosY(y);
|
sprite->setPosY(y);
|
||||||
@@ -583,13 +469,38 @@ void Player::animate()
|
|||||||
void Player::checkJumpEnd()
|
void Player::checkJumpEnd()
|
||||||
{
|
{
|
||||||
if (state == s_jumping)
|
if (state == s_jumping)
|
||||||
|
{
|
||||||
if (vy > 0)
|
if (vy > 0)
|
||||||
if (y >= jump_ini)
|
{
|
||||||
|
if (y >= jumpIni)
|
||||||
{ // Si alcanza la altura de salto inicial, pasa al estado de caída
|
{ // Si alcanza la altura de salto inicial, pasa al estado de caída
|
||||||
setState(s_falling);
|
setState(s_falling);
|
||||||
vy = maxVY;
|
vy = maxVY;
|
||||||
|
jumpCounter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calcula y reproduce el sonido de salto
|
||||||
|
void Player::playJumpSound()
|
||||||
|
{
|
||||||
|
if (jumpCounter % 4 == 0)
|
||||||
|
{
|
||||||
|
JA_PlaySound(jumpSound[jumpCounter / 4]);
|
||||||
|
}
|
||||||
|
debug->add("JUMP: " + std::to_string(jumpCounter / 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calcula y reproduce el sonido de caer
|
||||||
|
void Player::playFallSound()
|
||||||
|
{
|
||||||
|
if (fallCounter % 4 == 0)
|
||||||
|
{
|
||||||
|
JA_PlaySound(fallSound[std::min((fallCounter / 4), (int)fallSound.size() - 1)]);
|
||||||
|
}
|
||||||
|
debug->add("FALL: " + std::to_string(fallCounter / 4));
|
||||||
|
}
|
||||||
|
|
||||||
// Comprueba si el jugador tiene suelo debajo de los pies
|
// Comprueba si el jugador tiene suelo debajo de los pies
|
||||||
bool Player::isOnFloor()
|
bool Player::isOnFloor()
|
||||||
@@ -657,73 +568,6 @@ bool Player::checkWalls()
|
|||||||
return wall;
|
return wall;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si el jugador está en una rampa
|
|
||||||
tile_e Player::checkSlopes()
|
|
||||||
{
|
|
||||||
// Actualiza los puntos de colisión
|
|
||||||
updateFeet();
|
|
||||||
|
|
||||||
bool slope_l = false;
|
|
||||||
bool slope_r = false;
|
|
||||||
|
|
||||||
// Comprueba si ha colisionado con una rampa
|
|
||||||
for (auto f : feet)
|
|
||||||
{
|
|
||||||
slope_l |= (room->getTile(f) == t_slope_l);
|
|
||||||
slope_r |= (room->getTile(f) == t_slope_r);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slope_l)
|
|
||||||
{
|
|
||||||
return t_slope_l;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slope_r)
|
|
||||||
{
|
|
||||||
return t_slope_r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return t_empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba si el jugador está en una rampa
|
|
||||||
tile_e Player::checkSlopes2()
|
|
||||||
{
|
|
||||||
// Actualiza los puntos de colisión
|
|
||||||
updateFeet();
|
|
||||||
|
|
||||||
bool slope_l = false;
|
|
||||||
bool slope_r = false;
|
|
||||||
bool wall = false;
|
|
||||||
bool passable = false;
|
|
||||||
|
|
||||||
// Comprueba si ha colisionado con una rampa
|
|
||||||
for (auto f : underFeet)
|
|
||||||
{
|
|
||||||
slope_l |= (room->getTile(f) == t_slope_l);
|
|
||||||
slope_r |= (room->getTile(f) == t_slope_r);
|
|
||||||
wall |= (room->getTile(f) == t_wall);
|
|
||||||
passable |= (room->getTile(f) == t_passable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wall || passable)
|
|
||||||
{
|
|
||||||
return t_empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slope_l)
|
|
||||||
{
|
|
||||||
return t_slope_l;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slope_r)
|
|
||||||
{
|
|
||||||
return t_slope_r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return t_empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtiene algunos parametros del jugador
|
// Obtiene algunos parametros del jugador
|
||||||
player_t Player::getSpawnParams()
|
player_t Player::getSpawnParams()
|
||||||
{
|
{
|
||||||
@@ -733,7 +577,7 @@ player_t Player::getSpawnParams()
|
|||||||
params.y = y;
|
params.y = y;
|
||||||
params.vx = vx;
|
params.vx = vx;
|
||||||
params.vy = vy;
|
params.vy = vy;
|
||||||
params.jump_ini = jump_ini;
|
params.jumpIni = jumpIni;
|
||||||
params.state = state;
|
params.state = state;
|
||||||
params.flip = sprite->getFlip();
|
params.flip = sprite->getFlip();
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ struct player_t
|
|||||||
float y;
|
float y;
|
||||||
float vx;
|
float vx;
|
||||||
float vy;
|
float vy;
|
||||||
int jump_ini;
|
int jumpIni;
|
||||||
state_e state;
|
state_e state;
|
||||||
SDL_RendererFlip flip;
|
SDL_RendererFlip flip;
|
||||||
};
|
};
|
||||||
@@ -60,9 +60,12 @@ public:
|
|||||||
int border; // Indica en cual de los cuatro bordes se encuentra
|
int border; // Indica en cual de los cuatro bordes se encuentra
|
||||||
bool invincible; // Si es invencible, no puede morir
|
bool invincible; // Si es invencible, no puede morir
|
||||||
SDL_Rect lastPosition; // Contiene la ultima posición del jugador, por si hay que deshacer algun movimiento
|
SDL_Rect lastPosition; // Contiene la ultima posición del jugador, por si hay que deshacer algun movimiento
|
||||||
int jump_ini; // Valor del eje Y en el que se inicia el salto
|
int jumpIni; // Valor del eje Y en el que se inicia el salto
|
||||||
float maxVY; // Velocidad máxima que puede alcanzar al desplazarse en vertical
|
float maxVY; // Velocidad máxima que puede alcanzar al desplazarse en vertical
|
||||||
std::vector<JA_Sound> jumpSound; // Vecor con todos los sonidos del salto
|
std::vector<JA_Sound> jumpSound; // Vecor con todos los sonidos del salto
|
||||||
|
std::vector<JA_Sound> fallSound; // Vecor con todos los sonidos de la caída
|
||||||
|
int jumpCounter; // Cuenta el tiempo de salto
|
||||||
|
int fallCounter; // Cuenta el tiempo de caida
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
// Comprueba las entradas y modifica variables
|
// Comprueba las entradas y modifica variables
|
||||||
@@ -89,6 +92,12 @@ public:
|
|||||||
// Comprueba si ha finalizado el salto al alcanzar la altura de inicio
|
// Comprueba si ha finalizado el salto al alcanzar la altura de inicio
|
||||||
void checkJumpEnd();
|
void checkJumpEnd();
|
||||||
|
|
||||||
|
// Calcula y reproduce el sonido de salto
|
||||||
|
void playJumpSound();
|
||||||
|
|
||||||
|
// Calcula y reproduce el sonido de caer
|
||||||
|
void playFallSound();
|
||||||
|
|
||||||
// Comprueba si el jugador tiene suelo debajo de los pies
|
// Comprueba si el jugador tiene suelo debajo de los pies
|
||||||
bool isOnFloor();
|
bool isOnFloor();
|
||||||
|
|
||||||
@@ -98,12 +107,6 @@ public:
|
|||||||
// Comprueba que el jugador no atraviese ninguna pared
|
// Comprueba que el jugador no atraviese ninguna pared
|
||||||
bool checkWalls();
|
bool checkWalls();
|
||||||
|
|
||||||
// Comprueba si el jugador está en una rampa
|
|
||||||
tile_e checkSlopes();
|
|
||||||
|
|
||||||
// Comprueba si el jugador está en una rampa
|
|
||||||
tile_e checkSlopes2();
|
|
||||||
|
|
||||||
// Actualiza los puntos de colisión
|
// Actualiza los puntos de colisión
|
||||||
void updateColliderPoints();
|
void updateColliderPoints();
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,31 @@ void Title::checkEventHandler()
|
|||||||
section.subsection = 0;
|
section.subsection = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F:
|
||||||
|
screen->switchVideoMode();
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F1:
|
||||||
|
screen->setWindowSize(1);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F2:
|
||||||
|
screen->setWindowSize(2);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F3:
|
||||||
|
screen->setWindowSize(3);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_F4:
|
||||||
|
screen->setWindowSize(4);
|
||||||
|
texture->reLoad();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user