Example #1
0
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;
}
Example #2
0
 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();
 }
Example #3
0
bool BattleHazard::updateTB(GameState &state) { return updateInner(state, TICKS_PER_TURN); }
Example #4
0
 /**
  * J2DGameObject
  */
 J2DGameObject::J2DGameObject() {
     inner = new SDL_Rect();
     updateInner();
 }
Example #5
0
 void J2DMovGameObject::update() {
     x_pos += x_speed;
     y_pos += y_speed;
     updateInner();
 }
Example #6
0
 void J2DGameObject::set_size(int w, int h) {
     width = w;
     height = h;
     updateInner();
 }
Example #7
0
 void J2DGameObject::set_pos(int x, int y) {
     x_pos = x;
     y_pos = y;
     updateInner();
 }
Example #8
0
 J2DGameObject::J2DGameObject(int x, int y) {
     inner = new SDL_Rect();
     x_pos = x;
     y_pos = y;
     updateInner();
 }