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)
|
||||
SOURCES := source/*.cpp source/common/*.cpp
|
||||
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
|
||||
RM = del /Q
|
||||
MKD:= mkdir
|
||||
@@ -34,6 +34,7 @@ else
|
||||
FixPath = $1
|
||||
SOURCES := $(shell find $(DIR_SOURCES) -name '*.cpp')
|
||||
CXXFLAGS:= -std=c++11 -Wall -Os -ffunction-sections -fdata-sections
|
||||
CXXFLAGS_DEBUG:= -std=c++11 -Wall
|
||||
LDFLAGS := -lSDL2
|
||||
RM = rm -f
|
||||
MKD:= mkdir -p
|
||||
@@ -43,6 +44,7 @@ else
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
CXXFLAGS += -Wno-deprecated
|
||||
CXXFLAGS_DEBUG += -Wno-deprecated
|
||||
LDFLAGS += -framework OpenGL
|
||||
endif
|
||||
endif
|
||||
@@ -137,7 +139,7 @@ windows_rec:
|
||||
|
||||
windows_debug:
|
||||
@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:
|
||||
@echo off
|
||||
@@ -168,11 +170,8 @@ windows_release:
|
||||
macos:
|
||||
$(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:
|
||||
$(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:
|
||||
# Elimina datos de compilaciones anteriores
|
||||
@@ -225,7 +224,7 @@ linux:
|
||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
||||
|
||||
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
|
||||
|
||||
linux_release:
|
||||
|
||||
@@ -31,7 +31,7 @@ backgroundAttenuateColor.b 255
|
||||
backgroundAttenuateColor.a 0
|
||||
|
||||
## BALLOONS
|
||||
balloon1.vel 2.70f
|
||||
balloon1.vel 2.75f
|
||||
balloon1.grav 0.09f
|
||||
balloon2.vel 3.70f
|
||||
balloon2.grav 0.10f
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
frameWidth=35
|
||||
frameHeight=40
|
||||
frameWidth=39
|
||||
frameHeight=44
|
||||
|
||||
[animation]
|
||||
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/player1_power.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player2_power.gif", t_bitmap);
|
||||
|
||||
asset->add(prefix + "/data/gfx/player_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);
|
||||
|
||||
// Fuentes de texto
|
||||
|
||||
@@ -388,7 +388,8 @@ void Game::loadMedia()
|
||||
player1->addPalette(asset->get("player1_pal3.gif"));
|
||||
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);
|
||||
|
||||
playerTextures.push_back(player1Textures);
|
||||
@@ -400,7 +401,9 @@ void Game::loadMedia()
|
||||
player2->addPalette(asset->get("player2_pal3.gif"));
|
||||
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);
|
||||
|
||||
playerTextures.push_back(player2Textures);
|
||||
@@ -963,6 +966,11 @@ void Game::renderPlayers()
|
||||
if (player->isEnabled())
|
||||
{
|
||||
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;
|
||||
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
|
||||
enabled = false;
|
||||
init();
|
||||
@@ -129,8 +133,7 @@ void Player::move()
|
||||
playerSprite->setPosX(getPosX());
|
||||
playerSprite->setPosY(posY);
|
||||
|
||||
powerSprite->setPosX(getPosX() - 2);
|
||||
powerSprite->setPosY(posY - 10);
|
||||
powerSprite->setPosX(getPosX() - powerUpDespX);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -154,13 +157,13 @@ void Player::render()
|
||||
{
|
||||
if (powerUp && alive)
|
||||
{
|
||||
powerSprite->render();
|
||||
if (powerUpCounter > (PLAYER_POWERUP_COUNTER / 4) || powerUpCounter % 20 > 4)
|
||||
{
|
||||
powerSprite->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
|
||||
@@ -215,7 +218,7 @@ void Player::setAnimation()
|
||||
// Actualiza las animaciones de los sprites
|
||||
playerSprite->animate();
|
||||
|
||||
powerSprite->setFlip(flipWalk);
|
||||
// powerSprite->setFlip(flipWalk);
|
||||
powerSprite->animate();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ private:
|
||||
int coffees; // Indica cuantos cafes lleva acumulados
|
||||
bool powerUp; // Indica si el jugador tiene activo 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
|
||||
circle_t collider; // Circulo de colisión del jugador
|
||||
bool alive; // Indica si el jugador está vivo
|
||||
@@ -68,7 +69,6 @@ private:
|
||||
// Monitoriza el estado
|
||||
void updateInvulnerable();
|
||||
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Player(float x, int y, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
|
||||
|
||||
Reference in New Issue
Block a user