bool BattleHazard::update(GameState &state, unsigned int ticks) { bool realTime = state.current_battle->mode == Battle::Mode::RealTime; if (ticksUntilVisible > 0) { if (ticksUntilVisible > ticks) { ticksUntilVisible -= ticks; } else { ticksUntilVisible = 0; } } frameChangeTicksAccumulated += ticks; while (frameChangeTicksAccumulated >= TICKS_PER_HAZARD_UPDATE) { frameChangeTicksAccumulated -= TICKS_PER_HAZARD_UPDATE; frame++; frame %= hazardType->fire ? 2 : HAZARD_FRAME_COUNT; } if (realTime) { return updateInner(state, ticks); } return false; }
J2DGameObject::J2DGameObject(int x, int y, int w, int h) { inner = new SDL_Rect(); x_pos = x; y_pos = y; width = w; height = h; updateInner(); }
bool BattleHazard::updateTB(GameState &state) { return updateInner(state, TICKS_PER_TURN); }
/** * J2DGameObject */ J2DGameObject::J2DGameObject() { inner = new SDL_Rect(); updateInner(); }
void J2DMovGameObject::update() { x_pos += x_speed; y_pos += y_speed; updateInner(); }
void J2DGameObject::set_size(int w, int h) { width = w; height = h; updateInner(); }
void J2DGameObject::set_pos(int x, int y) { x_pos = x; y_pos = y; updateInner(); }
J2DGameObject::J2DGameObject(int x, int y) { inner = new SDL_Rect(); x_pos = x; y_pos = y; updateInner(); }