Skip to content
Snippets Groups Projects
Select Git revision
  • b66a9086ec325503f6876c53c58306196fb0de8d
  • main default protected
  • dev protected
  • feature/sound
  • v1.0.1
  • v1.0.0
6 results

enemy.cpp

Blame
  • enemy.cpp 784 B
    //
    // Created by llux on 27.01.25.
    //
    #include "enemy.hpp"
    
    namespace lvl
    {
    
    Enemy::Enemy(EnemyId id, int32_t health, int hitboxWidth, int hitboxHeight, std::vector<int32_t> spriteIndices)
        : m_Id(id), m_Health(health), m_Hitbox({hitboxWidth, hitboxHeight}), m_Sprites(std::move(spriteIndices)) {}
    
    Position Enemy::getHitbox() const
    {
        return m_Hitbox;
    }
    
    Enemy::EnemyId Enemy::getId() const
    {
        return m_Id;
    }
    
    int32_t Enemy::getHealth() const
    {
        return m_Health;
    }
    
    const std::vector<int32_t>& Enemy::getSprites() const
    {
        return m_Sprites;
    }
    
    std::vector<Enemy> Enemy::defaultEnemies()
    {
        return {Enemy(0, 30, 16, 16, {22, 23, 24, 25}),
            Enemy(1, 50, 16, 16, {74, 75, 76, 77}),
            Enemy(2, 70, 16, 16, {146, 147, 148, 149})
        };
    }
    
    } // namespace lvl