mise a jour des textures
This commit is contained in:
		
							parent
							
								
									3f117001f4
								
							
						
					
					
						commit
						d010bd56da
					
				
							
								
								
									
										
											BIN
										
									
								
								res/ball.png
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								res/ball.png
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 992 B | 
							
								
								
									
										
											BIN
										
									
								
								res/block.png
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								res/block.png
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 1.1 KiB | 
|  | @ -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() {} | ||||
|  |  | |||
|  | @ -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(); | ||||
| } | ||||
|  |  | |||
|  | @ -58,18 +58,25 @@ sf::Vector2f Player::getForces(const Manager& manager, const std::vector<ObjectP | |||
| 
 | ||||
| void Player::draw(Manager& manager) { | ||||
|     Object::draw(manager); | ||||
| 
 | ||||
|      | ||||
|     // utilisation de la texture
 | ||||
| 	sprite.setTexture( | ||||
|         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(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue