Example #1
0
Laser::Laser(const glm::vec2& position, float angleDegs, LaserType type)
	: m_StartPosition(position)
	, m_Angle(angleDegs)
	, m_Type(type)
	, SPEED(Game::HEIGHT / 1000.f)
{
	setVelocity();
	setupSprite();
	setupShape();
}
Example #2
0
Asteroid::Asteroid()
    : m_StartPosition(getRandomPosition())
    , m_Velocity(getRandomVelocity())
    , m_RotationSpeed(getRandomRotationSpeed())
    , m_Speed(getRandomSpeed())
    , m_Type(getRandomType())
    , m_HasBeenStruck(false)
{
    setupSprite();
    setupShape();
}
Example #3
0
Asteroid::Asteroid(const glm::vec2& position, AsteroidType::Type type)
    : m_StartPosition(position)
    , m_Velocity(getRandomVelocity() * SUB_ASTEROID_VELOCITY_FACTOR)
    , m_RotationSpeed(getRandomRotationSpeed() * SUB_ASTEROID_ROTATION_SPEED_FACTOR)
    , m_Speed(getRandomSpeed() * SUB_ASTEROID_SPEED_FACTOR)
    , m_Type(type)
    , m_HasBeenStruck(false)
{
    setupSprite();
    setupShape();
}
Example #4
0
Powerup::Powerup(const glm::vec2& position, const glm::vec2& velocity, PowerupType::Type type)
	: m_StartPosition(position)
	, m_Velocity(velocity)
	, m_Type(type)
{
	std::vector<float> rotationDirections = { -1.f, 1.f };
	m_RotationSpeed = Random::genFloat(0.18f, 0.36f) * Random::choice(rotationDirections);

	setupSprite();
	setupShape();
}
Example #5
0
CVehicle::CVehicle(int p_owner, string p_name, int p_moveRange, int p_optics, int p_hp, int defense, int armor, int chassisType,
	   CWeapon *primary, CWeapon *support, gamePoint p_pos, CSDL_Setup *p_csdl_setup, SDL_Texture *p_texture, CEnvironment *p_environment)
			 	   : CUnit(p_owner, p_name, UNIT_VEHICLE, p_moveRange, p_optics, p_hp, defense, armor, primary, support, p_pos, p_csdl_setup, p_texture, p_environment)
{
    SDL_Rect portion;
	if (p_owner == 0)
	{
        if (chassisType == 0)
        {
            portion.x = 0;
            portion.y = 320;
            portion.w = 320;
            portion.h = 160;
        }
        else
        {
            portion.x = 0;
            portion.y = 480;
            portion.w = 320;
            portion.h = 160;
        }
	}
	else
	{
        if (chassisType == 0)
        {
            portion.x = 320;
            portion.y = 320;
            portion.w = 320;
            portion.h = 160;
        }
        else
        {
            portion.x = 320;
            portion.y = 480;
            portion.w = 320;
            portion.h = 160;
        }
	}
	setupSprite(portion, p_csdl_setup, NULL, NULL, 4, 2);
}
Example #6
0
CInfantry::CInfantry(int p_owner, string p_name, int p_moveRange, int p_optics, int p_hp, int defense, int armor, 
	CWeapon *primary, CWeapon *support, customPoint p_pos, CSDL_Setup *p_csdl_setup, SDL_Texture *p_texture, CEnvironment *p_environment)
			 : CUnit(p_owner, p_name, UNIT_INFANTRY, p_moveRange, p_optics, p_hp, defense, armor, primary, support, p_pos, p_csdl_setup, p_texture, p_environment, false)
{
	SDL_Rect portion;
	if (p_owner == 0) 
	{
		portion.x = 0;
		portion.y = 0;
		portion.w = 320;
		portion.h = 160;
	}
	else
	{
		portion.x = 320;
		portion.y = 0;
		portion.w = 320;
		portion.h = 160;
	}
	setupSprite(portion, p_csdl_setup, NULL, NULL, 4, 2);
}