mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 22:23:43 +00:00
minor balancing to powerups and shooting speed
This commit is contained in:
parent
b814fa3298
commit
c79ba00b20
@ -7,7 +7,7 @@ using Team = std::size_t;
|
|||||||
|
|
||||||
constexpr std::size_t MAX_COMPONENTS = 32;
|
constexpr std::size_t MAX_COMPONENTS = 32;
|
||||||
constexpr std::size_t MAX_GROUPS = 32;
|
constexpr std::size_t MAX_GROUPS = 32;
|
||||||
constexpr std::size_t MAX_STATS = 32;
|
constexpr std::size_t MAX_STATS = 8;
|
||||||
constexpr std::size_t MAX_TEAMS = 8;
|
constexpr std::size_t MAX_TEAMS = 8;
|
||||||
|
|
||||||
constexpr int SCREEN_SIZE_HEIGHT = 640;
|
constexpr int SCREEN_SIZE_HEIGHT = 640;
|
||||||
@ -20,7 +20,7 @@ constexpr int TILE_SIZE = 32;
|
|||||||
constexpr int MAP_SIZE_X = 25;
|
constexpr int MAP_SIZE_X = 25;
|
||||||
constexpr int MAP_SIZE_Y = 20;
|
constexpr int MAP_SIZE_Y = 20;
|
||||||
|
|
||||||
constexpr int SPAWN_ATTEMPTS = 30;
|
constexpr int SPAWN_ATTEMPTS = 20;
|
||||||
|
|
||||||
constexpr int BUFF_DURATION = 6000;
|
constexpr int BUFF_DURATION = 6000;
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public:
|
|||||||
|
|
||||||
//for attack cooldown in between shots
|
//for attack cooldown in between shots
|
||||||
uint32_t lastFireTime;
|
uint32_t lastFireTime;
|
||||||
uint32_t fireCooldown = 800; //in ms can be adjusted to change possible attack-speed
|
uint32_t fireCooldown = 1000; //in ms can be adjusted to change possible attack-speed
|
||||||
|
|
||||||
KeyboardController() = default;
|
KeyboardController() = default;
|
||||||
KeyboardController(SDL_Scancode up, SDL_Scancode down, SDL_Scancode left, SDL_Scancode right, SDL_Scancode fire, Vector2D fireVelocity);
|
KeyboardController(SDL_Scancode up, SDL_Scancode down, SDL_Scancode left, SDL_Scancode right, SDL_Scancode fire, Vector2D fireVelocity);
|
||||||
|
|||||||
@ -119,7 +119,7 @@ void Game::init(const char* title, int xpos, int ypos, int width, int height, bo
|
|||||||
player1.setTeam(TeamLabel::BLUE);
|
player1.setTeam(TeamLabel::BLUE);
|
||||||
player1.addComponent<TransformComponent>(80,80,2); //posx, posy, scale
|
player1.addComponent<TransformComponent>(80,80,2); //posx, posy, scale
|
||||||
player1.addComponent<SpriteComponent>("assets/chicken_knight_spritesheet.png", true); //adds sprite (32x32px), path needed
|
player1.addComponent<SpriteComponent>("assets/chicken_knight_spritesheet.png", true); //adds sprite (32x32px), path needed
|
||||||
player1.addComponent<KeyboardController>(SDL_SCANCODE_W, SDL_SCANCODE_S, SDL_SCANCODE_A, SDL_SCANCODE_D, SDL_SCANCODE_E, Vector2D(1, 0));//custom keycontrols can be added
|
player1.addComponent<KeyboardController>(SDL_SCANCODE_W, SDL_SCANCODE_S, SDL_SCANCODE_A, SDL_SCANCODE_D, SDL_SCANCODE_E, Vector2D(2, 0));//custom keycontrols can be added
|
||||||
player1.addComponent<ColliderComponent>("player", 0.8f); //adds tag (for further use, reference tag)
|
player1.addComponent<ColliderComponent>("player", 0.8f); //adds tag (for further use, reference tag)
|
||||||
player1.addComponent<HealthComponent>(5, Direction::LEFT);
|
player1.addComponent<HealthComponent>(5, Direction::LEFT);
|
||||||
player1.addComponent<StatEffectsComponent>();
|
player1.addComponent<StatEffectsComponent>();
|
||||||
@ -129,7 +129,7 @@ void Game::init(const char* title, int xpos, int ypos, int width, int height, bo
|
|||||||
player2.setTeam(TeamLabel::RED);
|
player2.setTeam(TeamLabel::RED);
|
||||||
player2.addComponent<TransformComponent>(600, 500, 2);
|
player2.addComponent<TransformComponent>(600, 500, 2);
|
||||||
player2.addComponent<SpriteComponent>("assets/chicken_spritesheet.png", true);
|
player2.addComponent<SpriteComponent>("assets/chicken_spritesheet.png", true);
|
||||||
player2.addComponent<KeyboardController>(SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_RCTRL, Vector2D(-1, 0));
|
player2.addComponent<KeyboardController>(SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_RCTRL, Vector2D(-2, 0));
|
||||||
player2.addComponent<ColliderComponent>("enemy", 0.8f);
|
player2.addComponent<ColliderComponent>("enemy", 0.8f);
|
||||||
player2.addComponent<HealthComponent>(5, Direction::RIGHT);
|
player2.addComponent<HealthComponent>(5, Direction::RIGHT);
|
||||||
player2.addComponent<StatEffectsComponent>();
|
player2.addComponent<StatEffectsComponent>();
|
||||||
|
|||||||
@ -59,12 +59,12 @@ void KeyboardController::update()
|
|||||||
if (fireVelocity.x > 0) {
|
if (fireVelocity.x > 0) {
|
||||||
sprite->setDirection(Direction::RIGHT);
|
sprite->setDirection(Direction::RIGHT);
|
||||||
Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity,
|
Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity,
|
||||||
false, 1, 180, 1, "assets/egg.png", this->entity->getTeam());
|
false, 1, 180, 2, "assets/egg.png", this->entity->getTeam());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprite->setDirection(Direction::LEFT);
|
sprite->setDirection(Direction::LEFT);
|
||||||
Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity,
|
Game::assets->createProjectile(Vector2D(player->position.x, player->position.y), fireVelocity,
|
||||||
true, 1, 180, 1, "assets/egg.png", this->entity->getTeam());
|
true, 1, 180, 2, "assets/egg.png", this->entity->getTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
lastFireTime = currentTicks;
|
lastFireTime = currentTicks;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user