コード例 #1
0
ファイル: testApp.cpp プロジェクト: josephrmoore/OF_apps
//--------------------------------------------------------------
void testApp::update(){
    checkOsc();
    potato.setPosition(pos);
    potato.setVelocity(vel);
    potato.setFixedRotation(rot);
    box2d.update();
}
コード例 #2
0
ファイル: testApp.cpp プロジェクト: bfata/AlgoFinal2
//--------------------------------------------------------------
void testApp::update(){
    checkOsc();
    
    ballPos.set(fader1 * 400,ofGetWindowHeight()/2);
   // cout << fader1Value << endl;
    for (int i = 0; i < particleCount; i++){
        particles[i].resetForce();
        particles[i].addAttraction(ballPos.x, ballPos.y, 1000, fader2Value);
        particles[i].addRepulsion(ballPos.x, ballPos.y, 30, 35);
        particles[i].addRepulsion(shipPos.x, shipPos.y, 30, 35);

        particles[i].addDamping();
        particles[i].update();
        
        if(particles[i].pos.x < 0){
            particles[i].pos.x = ofGetWindowWidth()+2;
            particles[i].pos.y = ofRandom(ofGetWindowHeight());
        }
        
        // Have particles trail one another
//        if (i == 0){
//            particles[i].trail(ballPos.x, ballPos.y);
//        }else{
//            particles[i].trail(particles[i-1].pos.x, particles[i-1].pos.y);
//        }
    }
    
    counter = counter + 0.0013f;
}
コード例 #3
0
ファイル: testApp.cpp プロジェクト: yiningh/huang_algo2013
//--------------------------------------------------------------
void testApp::update(){
    checkOsc();
}
コード例 #4
0
ファイル: testApp.cpp プロジェクト: eggs/algo2013
//--------------------------------------------------------------
void testApp::update(){
    checkOsc();
    
    
    bgColor *= 0.95;
}
コード例 #5
0
//--------------------------------------------------------------
void testApp::update(){
    
    if ( gameState == 0 ) {
        startScreenFade += startScreenFadeVel;
        if ( startScreenFade < 0 || startScreenFade > 255 ) {
            startScreenFadeVel *= -1;
        }
        return;
    }
    
    checkOsc(); //Matt
    
    { // Mauricio
        //ship1.update();
        //secondBackground.update();
        
        //Mauricio
        //After trying to coming up with a counter that goes up and down, Jennifer Presto provided this. withour her contribution it woudn't have been possible to achive it.
        frameNum = abs ( abs( 49 - counter) - 49);
        counter++;
        
        if( counter == 100){
            
            counter = 0;
        }
    }
    
    collideSpaceshipsAndBullets();
    collideSpaceshipsAndSpaceships();
    collideEnemyAndBullets();
    collideSpaceshipsAndEnemy();
    
    { // Matt
        if ( !metroid.bDestroyMe ) metroid.update(shipList);
        
        for ( int i = 0; i < shipList.size(); i++ ) {
            shipList[ i ].update();
            // Handle firing.
            if ( shipList[ i ].bFiring ) {
                if ( shipList[ i ].firePacer == 0 ) {
                    float fireAng = shipList[ i ].rotAngle - PI;
                    Bullet tmp( shipList[ i ].pos, fireAng );
                    bulletList.push_back( tmp );
                    shipList[ i ].firePacer = shipList[ i ].pacerMax;
                    shipList[ i ].applyAngularForce( 0.5, fireAng );
                }
            }
        }
        
        for ( int i = 0; i < bulletList.size(); i++ ) {
            bulletList[ i ].update();
        }
        
        // AWESOME, come back to this later.
        //        if ( shipList[ 0 ].shootBullet && shipList[ 0 ].allowAction ) {
        //            float fireAng = shipList[ 0 ].rotAngle - PI;
        //            Bullet tmp( shipList[ 0 ].pos, fireAng );
        //            bulletList.push_back( tmp );
        //        }
    }
    
    
    
    // Note from Matt: Following up the boolean function we created above, this oF function sorts the vector according to the values of the booleans and then removes any with a 'true' value:
    ofRemove( bulletList, bShouldIErase );
    ofRemove( shipList, bShouldIErase2 );
    
    if (metroid.bDestroyMe){
        
        
        deque<Michael>::iterator it;
        for( it = kahane.begin(); it != kahane.end(); it++){
            
            it->resetForces();
            it->addDampingForce();
            it->update();
        }
    
    }
}