1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
// this is in dropTower.cpp
void dropTower::update_move (void) {
// elevator_flag is used to track whether the elevator is going up or down
// false = elevator is going down / elevator has reached max height
// true = elevator is going up / elevator has reached min height
if (elevator_flag == false) {
elevator_move-=2;
if (elevator_move <= 0.0) {
elevator_flag = true;
}
}
else {
elevator_move+=0.5;
if (elevator_move >= 300.0) {
elevator_flag = false;
ride_scream();
}
}
};
void dropTower::draw_tower(void) {
vec3D vecDt(300,300,300); // position of drop tower
glPushMatrix();
glColor3f(0,1,0);
glTranslatef(vecDt.get_x(), vecDt.get_y(), vecDt.get_z());
draw_base();
glTranslatef(100.0,30.0,-100.0);
glPushMatrix();
glRotatef(-90.0, 1, 0, 0);
draw_support();
glPopMatrix();
glPushMatrix();
glTranslatef(0.0, 40.0, 0.0);
glTranslatef(0.0, elevator_move, 0.0);
glRotatef(90,1,0,0);
draw_elevator();
glPopMatrix();
glPopMatrix();
}
|