13void Game::tryAwakeGod() {
27bool Game::manageGod() {
88 if (players.size() == 1)target =
PLAYER1;
89 else target = rand() % players.size();
108 invaderPos = invaderPos + a;
110 bool touched =
false;
113 if (invaderPos.getY() + confData.
invadersSize >= pm->getScreenWidth() ||
114 (invaderPos.getX() < 0 || invaderPos.getX() + confData.
invadersSize >= pm->getScreenWidth())) {
119 if(!areThereInvadersLeft())
return true;
123 for (
Player &p: players) {
127 invaderPos.getX(), invaderPos.getX() + confData.
invadersSize
148 throw runtime_error(
"SHOULD NOT HAPPEN : invalid action for god : ID="+ to_string(
static_cast<int>(god.
state)));
unsigned counter
timer used differently in all states
unsigned thrownInvPosY
y index (invader in the column) of the invader thrown by the hand of god
Position thrownTransition
position of a point for bezier's curve (used in RETRIEVE1 and RETRIEVE2 states, for the hand animatio...
Position getRightHandPos(unsigned screenWidth) const
give initial the pixel coordinates of god's right hand
Position thrownVector
direction of the thrown invader movement
GodState state
god's current state
InvaderType thrownInvType
type of the invader thrown by the hand of god
unsigned thrownInvPosX
x index (column in the grid) of the invader thrown by the hand of god
unsigned randomValidCol() const
Returns a random valid column in the grid.
full game logic and display management
#define GOD_HAND_DISTANCE
unsigned playersWidth
player horizontal size in pixel
unsigned invadersSize
invader radius size in pixel
#define INV_GET_SINGLE_POS(i)
bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2)
tells if 2 lines are colliding in a 1 dimensional space. Didn't want to use Position because of the s...
void applyTransformation(Position &pos, unsigned sizeFrom, unsigned sizeTo)
change the position object to reflect the top-right position of a "sizeTo"-sized entity,...
nsGraphics::Vec2D Position