Deuxieme commit
This commit is contained in:
@@ -10,11 +10,9 @@ class Bomb {
|
||||
bool _active;
|
||||
public:
|
||||
Bomb(): _position({0, 0}), _timer(3), _active(false) {
|
||||
std::cout << "Bomb created at default position " << std::endl;
|
||||
};
|
||||
|
||||
Bomb(Position position) : _position(position), _timer(3), _active(false) {
|
||||
std::cout << "Bomb created at " << position << std::endl;
|
||||
}
|
||||
|
||||
void activate() { _active = true; }
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//Bomberman.cpp
|
||||
#include "Bomberman.hpp"
|
||||
|
||||
Bomberman::Bomberman(const Position &position, unsigned short numberOfBombs)
|
||||
: _position(position), _numberOfBombs(numberOfBombs) {
|
||||
std::cout << "Bomberman created at position ("
|
||||
<< _position.getX() << ", " << _position.getY()
|
||||
<< ") with " << _numberOfBombs
|
||||
<< " bombs!" << std::endl;
|
||||
}
|
||||
|
||||
+7
-2
@@ -7,10 +7,15 @@ class Bomberman {
|
||||
|
||||
private:
|
||||
Position _position;
|
||||
unsigned short _numberOfBombs;
|
||||
unsigned short _maxNumberOfBombs = 1;
|
||||
unsigned short _numberOfBombsPlanted = 0;
|
||||
Bomb _bomb;
|
||||
public:
|
||||
Bomberman(){std::cout << "Bomberman created!" << std::endl;}
|
||||
Bomberman(const Position &position, unsigned short numberOfBombs);
|
||||
~Bomberman(){std::cout << "Bomberman destroyed!" << std::endl;};
|
||||
int plantBomb();
|
||||
friend std::ostream& operator<<(std::ostream &os, const Bomberman &bomberman) {
|
||||
os << "Bomberman at " << bomberman._position << ", Number of bombs: " << bomberman._numberOfBombs;
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,13 +8,15 @@ SRC = main.cpp \
|
||||
|
||||
OBJ = $(SRC:.cpp=.o)
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJ)
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJ)
|
||||
|
||||
$(OBJ): $(SRC)
|
||||
$(CC) $(CFLAGS) -c $(SRC) -o $@
|
||||
$(CC) $(CFLAGS) -c $(SRC)
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
fclean: clean
|
||||
|
||||
Reference in New Issue
Block a user