void renderGameplay(App *app){ SDL_BlitSurface(app->game.board.image, NULL, app->screen, NULL); renderDebug(app); if(app->game.winner){ app->game.winner->grabbing = 0; } if(app->game.head.body.life <= 0){ app->game.allan.body.action = ACTION_DEATH; app->game.indy.body.action = ACTION_DEATH; renderGameOver(app); } if(app->game.winner){ renderWinner(app); } renderLifeBars(app); renderEnemies(app); renderPlayer(app, &app->game.indy); renderPlayer(app, &app->game.allan); renderHead(app); renderHints(app); checkPlayerLife(&app->game.indy, app); checkPlayerLife(&app->game.allan, app); }
void Robot::render(float xPos, float yPos, float zPos) { glPushMatrix(); glTranslatef(xPos, yPos, zPos); // move to (0, 0, -30) // draw head and torso parts renderHead(0.0f, 3.5f, 0.0f); renderTorso(0.0f, 0.0f, 0.0f); // move the left arm away from the torso and rotate it to give "walking" effect glPushMatrix(); glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(m_armAngles[LEFT], 1.0f, 0.0f, 0.0f); renderArm(2.0f, 0.0f, -0.0f); glPopMatrix(); // move the right arm away from the torso and rotate it to give "walking" effect glPushMatrix(); glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(m_armAngles[RIGHT], 1.0f, 0.0f, 0.0f); renderArm(-2.0f, 0.0f, -0.0f); glPopMatrix(); // move the left leg away from the torso and rotate it to give "walking" effect glPushMatrix(); glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(m_legAngles[LEFT], 1.0f, 0.0f, 0.0f); renderLeg(-1.0f, -5.0f, -0.5f); glPopMatrix(); // move the right leg away from the torso and rotate it to give "walking" effect glPushMatrix(); glTranslatef(0.0f, -0.5f, 0.0f); glRotatef(m_legAngles[RIGHT], 1.0f, 0.0f, 0.0f); renderLeg(1.0f, -5.0f, -0.5f); glPopMatrix(); glPopMatrix(); }