Masse par défaut des objets : 0
This commit is contained in:
parent
b472cadfcd
commit
910345ad63
|
@ -163,9 +163,11 @@ public:
|
||||||
const std::vector<Player::Ptr>& getPlayers() const;
|
const std::vector<Player::Ptr>& getPlayers() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute un nouvel objet
|
* Ajoute un nouvel objet. Retourne l'objet
|
||||||
|
* si il a bien été ajouté, ou nullptr si l'ajout
|
||||||
|
* a été bloqué
|
||||||
*/
|
*/
|
||||||
void addObject(Object::Ptr object);
|
Object::Ptr addObject(Object::Ptr object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime l'objet donné
|
* Supprime l'objet donné
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
const unsigned int Block::TYPE_ID = 2;
|
const unsigned int Block::TYPE_ID = 2;
|
||||||
|
|
||||||
Block::Block() : Object() {
|
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
|
// déplacement de l'origine au centre du bloc
|
||||||
sprite.setOrigin(sf::Vector2f(23, 23));
|
sprite.setOrigin(sf::Vector2f(23, 23));
|
||||||
select_sprite.setOrigin(sf::Vector2f(23, 23));
|
select_sprite.setOrigin(sf::Vector2f(23, 23));
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
|
||||||
#include "game.hpp"
|
#include "game.hpp"
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#include <iostream>
|
|
||||||
#include "manager.hpp"
|
#include "manager.hpp"
|
||||||
|
|
||||||
const unsigned int Manager::FPS = 60;
|
const unsigned int Manager::FPS = 60;
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
#include "level.hpp"
|
#include "level.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "collision.hpp"
|
#include "collision.hpp"
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
const unsigned int Object::PROP_MASS = 1;
|
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 unsigned int Object::PROP_CHARGE = 2;
|
||||||
const float DEFAULT_CHARGE = 0.f;
|
const float DEFAULT_CHARGE = 0.f;
|
||||||
const unsigned int Object::PROP_RESTITUTION = 3;
|
const unsigned int Object::PROP_RESTITUTION = 3;
|
||||||
|
@ -338,9 +337,6 @@ float Object::getMassInvert() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::setMass(float set_mass) {
|
void Object::setMass(float set_mass) {
|
||||||
if (getTypeId() == 1){
|
|
||||||
std::cout << "Change mass player from " << mass << " to " << set_mass << std::endl;
|
|
||||||
}
|
|
||||||
mass = set_mass;
|
mass = set_mass;
|
||||||
inv_mass = -1.f;
|
inv_mass = -1.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,9 @@ Object::Ptr WidgetToolbar::createMovableBlock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Ptr WidgetToolbar::createPlayer() {
|
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) {
|
Object::Ptr WidgetToolbar::createGravityBlock(GravityDirection direction) {
|
||||||
|
|
Loading…
Reference in New Issue