46
SFML projects / Sketch RPG
« on: September 04, 2010, 11:34:45 pm »
Update: First Video
Update 2: New Video
Update 2: New Video
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
sf::IntRect NewRect(0,(190 - ( (float)m_life / m_max_life * 190 )),76,190);
void character::Dec_Life(int Damage,sf::Sprite& Lifebar)
{
m_life -= Damage;
Lifebar.SetSubRect(sf::IntRect(0,0,95, m_life / m_max_life * 190));
Lifebar.Move(0, (768 - 190 + ( 190 - (m_life / m_max_life * 190))));
}
if(Input.IsKeyDown(sf::Key::Right))
{
Player.ChangeAnim(2);
Player.PlayAnim();
Player.Sprite.SetPosition(XPos+Player.Speed,YPos);
GameView.Move(Player.Speed,0);
if(test.PixelPerfectTest(Player.Sprite,CBox))//if collision
{
Player.Sprite.SetPosition(XPos,YPos);//reset the sprite
GameView.Move(-Player.Speed,0);//reset the map
}
return;
}
const sf::Input& Input = window.GetInput();/
float ResetValue = 1.0f;
float XPos = Player.Sprite.GetPosition().x;//Position of the player sprite
float YPos = Player.Sprite.GetPosition().y;
if(Input.IsKeyDown(sf::Key::Right)
if(test.PixelPerfectTest(Player.Sprite,TestBox))//Testbox is a sprite
Player.Sprite.SetPosition(XPos-ResetValue,YPos);
else
Player.Sprite.SetPosition(XPos+Player.Speed,YPos);