Compare commits
3 Commits
1f4d7ce042
...
4df505d263
| Author | SHA1 | Date | |
|---|---|---|---|
| 4df505d263 | |||
| ffef64b4fd | |||
| 2358b8e914 |
13
Makefile
13
Makefile
@@ -26,7 +26,7 @@ ifeq ($(OS),Windows_NT)
|
|||||||
FixPath = $(subst /,\,$1)
|
FixPath = $(subst /,\,$1)
|
||||||
SOURCES := source/*.cpp source/common/*.cpp
|
SOURCES := source/*.cpp source/common/*.cpp
|
||||||
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows
|
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows
|
||||||
CXXFLAGS2:= -std=c++11 -Wall -static-libstdc++
|
CXXFLAGS_DEBUG:= -std=c++11 -Wall
|
||||||
LDFLAGS := -lmingw32 -lws2_32 -lSDL2main -lSDL2 -lopengl32
|
LDFLAGS := -lmingw32 -lws2_32 -lSDL2main -lSDL2 -lopengl32
|
||||||
RM = del /Q
|
RM = del /Q
|
||||||
MKD:= mkdir
|
MKD:= mkdir
|
||||||
@@ -34,6 +34,7 @@ else
|
|||||||
FixPath = $1
|
FixPath = $1
|
||||||
SOURCES := $(shell find $(DIR_SOURCES) -name '*.cpp')
|
SOURCES := $(shell find $(DIR_SOURCES) -name '*.cpp')
|
||||||
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections
|
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections
|
||||||
|
CXXFLAGS_DEBUG:= -std=c++11 -Wall
|
||||||
LDFLAGS := -lSDL2
|
LDFLAGS := -lSDL2
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
MKD:= mkdir -p
|
MKD:= mkdir -p
|
||||||
@@ -43,6 +44,7 @@ else
|
|||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
CXXFLAGS += -Wno-deprecated
|
CXXFLAGS += -Wno-deprecated
|
||||||
|
CXXFLAGS_DEBUG += -Wno-deprecated
|
||||||
LDFLAGS += -framework OpenGL
|
LDFLAGS += -framework OpenGL
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -137,7 +139,7 @@ windows_rec:
|
|||||||
|
|
||||||
windows_debug:
|
windows_debug:
|
||||||
@echo off
|
@echo off
|
||||||
$(CXX) $(SOURCES) -D VERBOSE $(CXXFLAGS2) $(LDFLAGS) -o "$(TARGET_FILE)_debug.exe"
|
$(CXX) $(SOURCES) -D DEBUG -D VERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug.exe"
|
||||||
|
|
||||||
windows_release:
|
windows_release:
|
||||||
@echo off
|
@echo off
|
||||||
@@ -168,11 +170,8 @@ windows_release:
|
|||||||
macos:
|
macos:
|
||||||
$(CXX) $(SOURCES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
$(CXX) $(SOURCES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
||||||
|
|
||||||
macos_fast:
|
|
||||||
$(CXX) $(SOURCES) -D VERBOSE -std=c++11 -Wall -Wno-deprecated -lSDL2 -framework OpenGL -o "$(TARGET_FILE)"
|
|
||||||
|
|
||||||
macos_debug:
|
macos_debug:
|
||||||
$(CXX) $(SOURCES) -D DEBUG $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
$(CXX) $(SOURCES) -D DEBUG -D VERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
||||||
|
|
||||||
macos_release:
|
macos_release:
|
||||||
# Elimina datos de compilaciones anteriores
|
# Elimina datos de compilaciones anteriores
|
||||||
@@ -225,7 +224,7 @@ linux:
|
|||||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
||||||
|
|
||||||
linux_debug:
|
linux_debug:
|
||||||
$(CXX) $(SOURCES) -D DEBUG $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
$(CXX) $(SOURCES) -D DEBUG -D VERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
||||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)_debug" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)_debug" --strip-unneeded
|
||||||
|
|
||||||
linux_release:
|
linux_release:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ backgroundAttenuateColor.b 255
|
|||||||
backgroundAttenuateColor.a 0
|
backgroundAttenuateColor.a 0
|
||||||
|
|
||||||
## BALLOONS
|
## BALLOONS
|
||||||
balloon1.vel 2.70f
|
balloon1.vel 2.75f
|
||||||
balloon1.grav 0.09f
|
balloon1.grav 0.09f
|
||||||
balloon2.vel 3.70f
|
balloon2.vel 3.70f
|
||||||
balloon2.grav 0.10f
|
balloon2.grav 0.10f
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
frameWidth=35
|
frameWidth=39
|
||||||
frameHeight=40
|
frameHeight=44
|
||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=default
|
name=default
|
||||||
|
|||||||
BIN
data/gfx/player_power.gif
Normal file
BIN
data/gfx/player_power.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 944 B |
BIN
data/gfx/player_power_pal.gif
Normal file
BIN
data/gfx/player_power_pal.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 B |
@@ -389,9 +389,8 @@ bool Director::setFileList()
|
|||||||
|
|
||||||
asset->add(prefix + "/data/gfx/player.ani", t_animation);
|
asset->add(prefix + "/data/gfx/player.ani", t_animation);
|
||||||
|
|
||||||
asset->add(prefix + "/data/gfx/player1_power.gif", t_bitmap);
|
asset->add(prefix + "/data/gfx/player_power.gif", t_bitmap);
|
||||||
asset->add(prefix + "/data/gfx/player2_power.gif", t_bitmap);
|
asset->add(prefix + "/data/gfx/player_power_pal.gif", t_palette);
|
||||||
|
|
||||||
asset->add(prefix + "/data/gfx/player_power.ani", t_animation);
|
asset->add(prefix + "/data/gfx/player_power.ani", t_animation);
|
||||||
|
|
||||||
// Fuentes de texto
|
// Fuentes de texto
|
||||||
|
|||||||
@@ -388,7 +388,8 @@ void Game::loadMedia()
|
|||||||
player1->addPalette(asset->get("player1_pal3.gif"));
|
player1->addPalette(asset->get("player1_pal3.gif"));
|
||||||
player1Textures.push_back(player1);
|
player1Textures.push_back(player1);
|
||||||
|
|
||||||
Texture *player1Power = new Texture(renderer, asset->get("player1_power.gif"));
|
Texture *player1Power = new Texture(renderer, asset->get("player_power.gif"));
|
||||||
|
player1Power->addPalette(asset->get("player_power_pal.gif"));
|
||||||
player1Textures.push_back(player1Power);
|
player1Textures.push_back(player1Power);
|
||||||
|
|
||||||
playerTextures.push_back(player1Textures);
|
playerTextures.push_back(player1Textures);
|
||||||
@@ -400,7 +401,9 @@ void Game::loadMedia()
|
|||||||
player2->addPalette(asset->get("player2_pal3.gif"));
|
player2->addPalette(asset->get("player2_pal3.gif"));
|
||||||
player2Textures.push_back(player2);
|
player2Textures.push_back(player2);
|
||||||
|
|
||||||
Texture *player2Power = new Texture(renderer, asset->get("player2_power.gif"));
|
Texture *player2Power = new Texture(renderer, asset->get("player_power.gif"));
|
||||||
|
player2Power->addPalette(asset->get("player_power_pal.gif"));
|
||||||
|
player2Power->setPalette(1);
|
||||||
player2Textures.push_back(player2Power);
|
player2Textures.push_back(player2Power);
|
||||||
|
|
||||||
playerTextures.push_back(player2Textures);
|
playerTextures.push_back(player2Textures);
|
||||||
@@ -963,6 +966,11 @@ void Game::renderPlayers()
|
|||||||
if (player->isEnabled())
|
if (player->isEnabled())
|
||||||
{
|
{
|
||||||
player->render();
|
player->render();
|
||||||
|
#ifdef DEBUG
|
||||||
|
//SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||||
|
//const circle_t c = player->getCollider();
|
||||||
|
//DrawCircle(renderer, c.x, c.y, c.r);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ Player::Player(float x, int y, std::vector<Texture *> texture, std::vector<std::
|
|||||||
defaultPosX = posX = x;
|
defaultPosX = posX = x;
|
||||||
defaultPosY = posY = y;
|
defaultPosY = posY = y;
|
||||||
|
|
||||||
|
// Establece los offsets para el sprite de PowerUp
|
||||||
|
powerUpDespX = (powerSprite->getWidth() - playerSprite->getWidth()) / 2;
|
||||||
|
powerSprite->setPosY(y - (powerSprite->getHeight() - playerSprite->getHeight()));
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
enabled = false;
|
enabled = false;
|
||||||
init();
|
init();
|
||||||
@@ -129,8 +133,7 @@ void Player::move()
|
|||||||
playerSprite->setPosX(getPosX());
|
playerSprite->setPosX(getPosX());
|
||||||
playerSprite->setPosY(posY);
|
playerSprite->setPosY(posY);
|
||||||
|
|
||||||
powerSprite->setPosX(getPosX() - 2);
|
powerSprite->setPosX(getPosX() - powerUpDespX);
|
||||||
powerSprite->setPosY(posY - 10);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -153,14 +156,14 @@ void Player::move()
|
|||||||
void Player::render()
|
void Player::render()
|
||||||
{
|
{
|
||||||
if (powerUp && alive)
|
if (powerUp && alive)
|
||||||
|
{
|
||||||
|
if (powerUpCounter > (PLAYER_POWERUP_COUNTER / 4) || powerUpCounter % 20 > 4)
|
||||||
{
|
{
|
||||||
powerSprite->render();
|
powerSprite->render();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
playerSprite->render();
|
playerSprite->render();
|
||||||
|
|
||||||
//SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
|
||||||
//DrawCircle(renderer, collider.x, collider.y, collider.r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el estado del jugador cuando camina
|
// Establece el estado del jugador cuando camina
|
||||||
@@ -215,7 +218,7 @@ void Player::setAnimation()
|
|||||||
// Actualiza las animaciones de los sprites
|
// Actualiza las animaciones de los sprites
|
||||||
playerSprite->animate();
|
playerSprite->animate();
|
||||||
|
|
||||||
powerSprite->setFlip(flipWalk);
|
// powerSprite->setFlip(flipWalk);
|
||||||
powerSprite->animate();
|
powerSprite->animate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ private:
|
|||||||
int coffees; // Indica cuantos cafes lleva acumulados
|
int coffees; // Indica cuantos cafes lleva acumulados
|
||||||
bool powerUp; // Indica si el jugador tiene activo el modo PowerUp
|
bool powerUp; // Indica si el jugador tiene activo el modo PowerUp
|
||||||
int powerUpCounter; // Temporizador para el modo PowerUp
|
int powerUpCounter; // Temporizador para el modo PowerUp
|
||||||
|
int powerUpDespX; // Desplazamiento del sprite de PowerUp respecto al sprite del jugador
|
||||||
bool input; // Indica si puede recibir ordenes de entrada
|
bool input; // Indica si puede recibir ordenes de entrada
|
||||||
circle_t collider; // Circulo de colisión del jugador
|
circle_t collider; // Circulo de colisión del jugador
|
||||||
bool alive; // Indica si el jugador está vivo
|
bool alive; // Indica si el jugador está vivo
|
||||||
@@ -68,7 +69,6 @@ private:
|
|||||||
// Monitoriza el estado
|
// Monitoriza el estado
|
||||||
void updateInvulnerable();
|
void updateInvulnerable();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Player(float x, int y, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
|
Player(float x, int y, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
|
||||||
|
|||||||
Reference in New Issue
Block a user