예제 #1
0
void handleMouseKeypress(int key, int state, int x, int y)
{
    switch (key) {
		case GLUT_LEFT_BUTTON:
            if (state == 0 && pause==FALSE){
                if (gun0.bullet_number > 0) {
					gun0.bullet_number--;
					pistola.pushAnimation(animation(locRot(0,0,0,10,0,-10),100,std::chrono::system_clock::now()));
					pistola.pushAnimation(animation(locRot(0,0,0,-10,0,10),100,std::chrono::system_clock::now()+std::chrono::milliseconds(100)));
                    collisionCurse();
                }
				else 
				{
					sound.setBuffer(sound_youreempty);
					sound.play();
				}
            }
            break;
    }
}
예제 #2
0
void changeLevel(int move)
{
    if (move == 1){
        // UP!
        if(livello<MAX_LIV){
			//animazione della camera
			if (livello==1) {
				//ruota verso destra
				main_camera.pushAnimation(animation( locRot(0.0,0.0,0.0,0.0,40.0,0.0),1500, std::chrono::system_clock::now() ));
				//spostati a destra
				main_camera.pushAnimation(animation( locRot(-65.0,0.0,5.0,0.0,-10.0,0.0),3000, std::chrono::system_clock::now() + std::chrono::milliseconds(1500) ));
				//ruota verso sinistra
				main_camera.pushAnimation(animation( locRot(0.0,0.0,0.0,0.0,-30.0,0.0),1000, std::chrono::system_clock::now() + std::chrono::milliseconds(4500) ));
			} else if (livello==2) {
				//ruota verso destra
				main_camera.pushAnimation(animation( locRot(0.0,0.0,0.0,0.0,40.0,0.0),1500, std::chrono::system_clock::now() ));
				//spostati a destra
				main_camera.pushAnimation(animation( locRot(-75.0,0.0,-15.0,0.0,-10.0,0.0),3000, std::chrono::system_clock::now() + std::chrono::milliseconds(1500) ));
				//ruota verso sinistra
				main_camera.pushAnimation(animation( locRot(0.0,0.0,0.0,0.0,-30.0,0.0),1000, std::chrono::system_clock::now() + std::chrono::milliseconds(4500) ));

			}

            
            for(int i=(livello*6);i<6+(livello*6);i++){
                m[i]=reset_motion(m[i]);
            }
            
            for(int i=((livello-1)*6);i<6+((livello-1)*6);i++){
                m[i].stato=2;
            }
            
            livello++;
            
        }
    } else {
        // DOWN!
        if(livello!=1){
            for(int i=((livello-2)*6);i<6+((livello-2)*6);i++){
                m[i]=reset_motion(m[i]);
            }
            for(int i=((livello-1)*6);i<6+((livello-1)*6);i++){
                m[i].stato=2;
            }
            
            livello--;
        }
    }
    
}