Move Physics constants in Ball

This commit is contained in:
Mattéo Delabre 2016-03-08 21:15:08 +01:00
parent d072686b0c
commit 68cce5f6e0
2 changed files with 6 additions and 3 deletions

View File

@ -13,11 +13,11 @@ sf::Vector2f Ball::getForces(State state) {
// déplacement de la balle après appui sur les touches de direction
if (state.goLeftKey) {
forces += sf::Vector2f(-Engine::MOVE, 0);
forces += sf::Vector2f(-Ball::MOVE, 0);
}
if (state.goRightKey) {
forces += sf::Vector2f(Engine::MOVE, 0);
forces += sf::Vector2f(Ball::MOVE, 0);
}
// force d'attraction entre les balles et les blocs chargés
@ -42,7 +42,7 @@ sf::Vector2f Ball::getForces(State state) {
// normalisation du vecteur direction qui porte
// la force d'attraction, puis application de la norme
attraction /= std::sqrt(distanceSquared);
attraction *= Engine::ATTRACTION * (
attraction *= Ball::ATTRACTION * (
(objects[i].getCharge() * objects[j].getCharge()) /
distanceSquared
);

View File

@ -13,6 +13,9 @@ protected:
*/
void getForces(State state);
static constexpr float ATTRACTION = 10;
static constexpr float MOVE = 10;
public:
Ball();