Transformation de la charge en float
This commit is contained in:
parent
7e9ebdda9f
commit
4a8b31816b
|
@ -8,7 +8,7 @@
|
|||
class Object {
|
||||
protected:
|
||||
sf::Vector2f position;
|
||||
int charge;
|
||||
float charge;
|
||||
int layer;
|
||||
|
||||
public:
|
||||
|
@ -48,12 +48,12 @@ public:
|
|||
/**
|
||||
* Récupère la charge de l'objet
|
||||
*/
|
||||
int getCharge();
|
||||
float getCharge();
|
||||
|
||||
/**
|
||||
* Modifie la charge de l'objet
|
||||
*/
|
||||
void setCharge(int set_charge);
|
||||
void setCharge(float set_charge);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,9 +20,9 @@ int main() {
|
|||
Block block8(9 * Constants::GRID, 7 * Constants::GRID);
|
||||
Block block9(10 * Constants::GRID, 7 * Constants::GRID);
|
||||
|
||||
ball1.setCharge(-2);
|
||||
ball2.setCharge(-2);
|
||||
block5.setCharge(16);
|
||||
ball1.setCharge(-2.f);
|
||||
ball2.setCharge(-2.f);
|
||||
block5.setCharge(16.f);
|
||||
|
||||
engine.addObject(ball1);
|
||||
engine.addObject(ball2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "object.hpp"
|
||||
|
||||
Object::Object(float x, float y) : position(x, y), charge(0), layer(10) {}
|
||||
Object::Object(float x, float y) : position(x, y), charge(0.f), layer(10) {}
|
||||
|
||||
sf::Vector2f Object::getPosition() {
|
||||
return position;
|
||||
|
@ -14,11 +14,11 @@ void Object::setLayer(unsigned int set_layer) {
|
|||
layer = set_layer;
|
||||
}
|
||||
|
||||
int Object::getCharge() {
|
||||
float Object::getCharge() {
|
||||
return charge;
|
||||
}
|
||||
|
||||
void Object::setCharge(int set_charge) {
|
||||
void Object::setCharge(float set_charge) {
|
||||
charge = set_charge;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue