예제 #1
0
SpaceMonkey::SpaceMonkey()
{
	IOdiff diff;
	IOsmooth smooth;

	speed = 0.3;
	health = 10 * diff.ReadDiffSettings();
	active = true;
	moveLeft = true;

	enemyTex.loadFromFile("graphics//enemies//spacemonkey.png");
	enemyTex.setSmooth(smooth.ReadSmoothSettings());
	sprite.setTexture(enemyTex);
	sprite.setOrigin(36, 20);
	sprite.setPosition(364, 25);

}
예제 #2
0
EnemyFormation::EnemyFormation(){

	//Get Settings
	IOdiff diff;
	IOsmooth smooth;

	//init stuff
	m_speed = 0.6f;
	m_damage = 15;
	m_active = true;
	m_die = false;
	m_hasTargetTexture = false;
	m_health = 3 * diff.ReadDiffSettings();
	m_maxHealth = m_health;

	m_texture.loadFromFile("graphics/enemies/enemyFormation.png");
	m_texture.setSmooth(smooth.ReadSmoothSettings());
	sprite.setTexture(m_texture);

	//initialize Healthbar
	initHealthBar();
}
예제 #3
0
Boss3firstWeapon::Boss3firstWeapon(){
	//read settings
	IOdiff diff;
	m_diff = diff.ReadDiffSettings();
	IOsmooth smooth;

	//init stuff
	m_speed = 0.5f;
	m_active = true;
	m_hasTargetTexture = false;
	m_health = 1;
	m_maxHealth = m_health;


	m_weaponTex.loadFromFile("graphics/enemies/cowWeapon.png");
	m_weaponTex.setSmooth(smooth.ReadSmoothSettings());
	sprite.setTexture(m_weaponTex);
	sprite.setRotation(180);
	sprite.setOrigin(m_weaponTex.getSize().x / 2.0f, m_weaponTex.getSize().y / 2.0f);

	//initialize Healthbar here to make sure that the position is known
	initHealthBar();
}
예제 #4
0
int Boss1Weapon::getDamage()
{
	IOdiff diff;
	return 25 * diff.ReadDiffSettings();
}
예제 #5
0
파일: DiffSet.cpp 프로젝트: Wint3rNuk3/Pew
int DiffSet::Run(sf::RenderWindow &window)
{
	//basic stuff
	running = true;
	IOdiff diff;
	selection = diff.ReadDiffSettings();
	Background bg("graphics//core//settings.jpg");

	//Sound
	IOsound iosound;
	iosound.ReadSoundSettings(volume);
	MenuSound sound;
	sound.LoadSoundBuffer();
	sound.setBuffer(volume);

	//buttons
	Text easy("easy", 70), normal("normal", 70), crazy("crazy", 70), info("enter = save, esc = back", 40);
	easy.setPosition(270, 150);
	normal.setPosition(270, 250);
	crazy.setPosition(270, 350);
	info.setPosition(50, 500);
	info.setColor(sf::Color(255, 128, 0));

	while (running)
	{
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::Closed)
			{
				return -1;
			}
			
			//keyboard selection
			if (event.type == sf::Event::KeyPressed)
			{
				switch (event.key.code)
				{
				case sf::Keyboard::Up:
					if (selection > 1)
					{
						selection -= 1;
						sound.PlaySound("select");
					}
					else
					{
						selection = 1;
					}
					break;
				case sf::Keyboard::Down:
					if (selection < 3)
					{
						selection += 1;
						sound.PlaySound("select");
					}
					else
					{
						selection = 3;
					}
					break;
				case sf::Keyboard::Return:
					diff.WriteDiffSettings(selection);
					return 2;
					break;
				case sf::Keyboard::Escape:
					return 2;
					break;
				default:
					break;
				}
			}
		}
		//change the color depending on selection
		if (selection == 1)//easy
		{
			easy.setColor(sf::Color(255, 128, 0));
			normal.setColor(sf::Color(255, 255, 255));
			crazy.setColor(sf::Color(255, 255, 255));
		}
		else if (selection == 2)//normal
		{
			easy.setColor(sf::Color(255, 255, 255));
			normal.setColor(sf::Color(255, 128, 0));
			crazy.setColor(sf::Color(255, 255, 255));
		}
		else //crazy
		{
			easy.setColor(sf::Color(255, 255, 255));
			normal.setColor(sf::Color(255, 255, 255));
			crazy.setColor(sf::Color(255, 128, 0));
		}
		
		//draw stuff
		window.clear();

		bg.Render(window);
		easy.Render(window);
		normal.Render(window);
		crazy.Render(window);
		info.Render(window);

		window.display();
	}
	return -1;
}