Masse par défaut des objets : 0

This commit is contained in:
Mattéo Delabre 2016-04-11 01:37:07 +02:00
parent b472cadfcd
commit 910345ad63
6 changed files with 8 additions and 14 deletions

View File

@ -163,9 +163,11 @@ public:
const std::vector<Player::Ptr>& getPlayers() const;
/**
* Ajoute un nouvel objet
* Ajoute un nouvel objet. Retourne l'objet
* si il a bien é ajouté, ou nullptr si l'ajout
* a é bloqué
*/
void addObject(Object::Ptr object);
Object::Ptr addObject(Object::Ptr object);
/**
* Supprime l'objet donné

View File

@ -7,10 +7,6 @@
const unsigned int Block::TYPE_ID = 2;
Block::Block() : Object() {
// par défaut, les blocs ne sont pas déplaçables et ont
// donc une masse infinie, représentée par 0
setMass(0.f);
// déplacement de l'origine au centre du bloc
sprite.setOrigin(sf::Vector2f(23, 23));
select_sprite.setOrigin(sf::Vector2f(23, 23));

View File

@ -1,5 +1,4 @@
#include <cmath>
#include <iostream>
#include "game.hpp"
#include "player.hpp"
#include "constants.hpp"

View File

@ -1,4 +1,3 @@
#include <iostream>
#include "manager.hpp"
const unsigned int Manager::FPS = 60;

View File

@ -2,11 +2,10 @@
#include "level.hpp"
#include "constants.hpp"
#include "collision.hpp"
#include <iostream>
#include <cmath>
const unsigned int Object::PROP_MASS = 1;
const float DEFAULT_MASS = 1.f;
const float DEFAULT_MASS = 0.f;
const unsigned int Object::PROP_CHARGE = 2;
const float DEFAULT_CHARGE = 0.f;
const unsigned int Object::PROP_RESTITUTION = 3;
@ -338,9 +337,6 @@ float Object::getMassInvert() const {
}
void Object::setMass(float set_mass) {
if (getTypeId() == 1){
std::cout << "Change mass player from " << mass << " to " << set_mass << std::endl;
}
mass = set_mass;
inv_mass = -1.f;
}

View File

@ -37,7 +37,9 @@ Object::Ptr WidgetToolbar::createMovableBlock() {
}
Object::Ptr WidgetToolbar::createPlayer() {
return Object::Ptr(new Player);
Object::Ptr player = Object::Ptr(new Player);
player->setMass(1.f);
return player;
}
Object::Ptr WidgetToolbar::createGravityBlock(GravityDirection direction) {