mise a jour des textures

This commit is contained in:
Rémi Cérès 2016-04-06 15:35:15 +02:00
parent 3f117001f4
commit d010bd56da
5 changed files with 17 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -11,7 +11,7 @@ Block::Block() : Object() {
setMass(0.f);
// déplacement de l'origine au centre du bloc
sprite.setOrigin(sf::Vector2f(Constants::GRID / 2, Constants::GRID / 2));
sprite.setOrigin(sf::Vector2f(Constants::GRID / 2, 46 - Constants::GRID / 2));
}
Block::~Block() {}

View File

@ -316,5 +316,12 @@ void Object::setLayer(int set_layer) {
}
bool ObjectCompare::operator()(ObjectPtr const &t1, ObjectPtr const &t2) const {
if (t1->getLayer() == t2->getLayer()) {
sf::Vector2f t1_pos = t1->getPosition();
sf::Vector2f t2_pos = t2->getPosition();
return t1_pos.x > t2_pos.x || t1_pos.y < t2_pos.y;
}
return t1->getLayer() > t2->getLayer();
}

View File

@ -64,12 +64,19 @@ void Player::draw(Manager& manager) {
manager.getResourceManager().getTexture("ball.png")
);
// coloration du jooueur en fonction de son numéro
if (getPlayerNumber() == 0) {
sprite.setColor(sf::Color(239, 83, 80));
} else if (getPlayerNumber() == 1) {
sprite.setColor(sf::Color(92, 107, 192));
}
// déplacement du sprite à la position de la balle
sprite.setPosition(getPosition());
manager.getWindow().draw(sprite);
}
void Player::updatePosition(float delta) {
void Player::updatePosition(float delta){
// calcul de la différence de position pour connaître
// (approximativement) la rotation de la balle
sf::Vector2f last_position = getPosition();