Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 11, 2014, 12:07:05 PM (10 years ago)
Author:
fvultier
Message:

Neue Platformen werden zur Laufzeit hinzugefugt, wenn sich die Ansicht nach oben verschiebt. Eigene Modelle importieren funktioniert.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickupsFS14/src/modules/jump/Jump.cc

    r10022 r10032  
    6060    {
    6161        RegisterObject(Jump);
     62        platformList.clear();
     63        yScreenPosition = 0;
     64        screenShiftSinceLastUpdate = 0;
     65
    6266        //this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    6367        //this->center_ = 0;
    64        // init();
    6568        //this->setHUDTemplate("JumpHUD");
    6669
    67     }
    68 
    69     void Jump::init()
    70     {
    71         /*bEndGame = false;
    72         lives = 3;
    73         level = 1;
    74         point = 0;
    75         bShowLevel = false;
    76         multiplier = 1;
    77         b_combo = false;*/
    78         // spawn enemy every 3.5 seconds
    79         //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Jump::spawnEnemy, this)));
    80         //comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&Jump::comboControll, this)));
    81     }
     70
     71    }
     72
    8273
    8374    /*void Jump::levelUp()
     
    10495        if (player == NULL)
    10596        {
    106                 ObjectList<JumpShip>::iterator it;
    107                 it = ObjectList<JumpShip>::begin();
    108                 /*for (ObjectList<JumpShip>::iterator it = ObjectList<JumpShip>::begin(); it != ObjectList<JumpShip>::end(); ++it)
     97                for (ObjectList<JumpShip>::iterator it = ObjectList<JumpShip>::begin(); it != ObjectList<JumpShip>::end(); ++it)
    10998                {
    11099                player = *it;
    111                 }*/
     100                }
    112101        }
    113102        return player;
    114103    }
     104
     105    void Jump::tick(float dt)
     106    {
     107
     108
     109        if (getPlayer() != NULL)
     110        {
     111            Vector3 shipPosition = getPlayer()->getPosition();
     112
     113                // Bildschirmposition kann nur nach oben verschoben werden
     114                if (shipPosition.y > yScreenPosition)
     115                {
     116                        screenShiftSinceLastUpdate += shipPosition.y - yScreenPosition;
     117
     118                        yScreenPosition = shipPosition.y;
     119                }
     120
     121                // Kameraposition nachfuehren
     122                if (camera == NULL)
     123                {
     124                        camera = getPlayer()->getCamera();
     125                }
     126            if (camera != NULL)
     127            {
     128                camera->setPosition(Vector3(-shipPosition.x, yScreenPosition-shipPosition.y, 100));
     129                //camera->setOrientation(Vector3::UNIT_Z, Degree(180));
     130            }
     131
     132            if (screenShiftSinceLastUpdate > 200.0)
     133            {
     134                screenShiftSinceLastUpdate -= 200.0;
     135                orxout() << "new section added" << endl;
     136                addPlatform(shipPosition.x, shipPosition.y + 300.0);
     137            }
     138
     139        }
     140
     141        SUPER(Jump, tick, dt);
     142    }
     143
    115144
    116145    /*void Jump::spawnEnemy()
     
    158187    }*/
    159188
    160     /*void Jump::start()
    161     {
    162         init();
     189
     190    void Jump::start()
     191    {
     192        // Call start for the parent class.
     193        Deathmatch::start();
     194
     195        /*
    163196        // Set variable to temporarily force the player to spawn.
    164197        this->bForceSpawn_ = true;
     
    170203            return;
    171204        }
    172         // Call start for the parent class.
    173         Deathmatch::start();
    174     }*/
     205        */
     206
     207        //addPlatform(0,0);
     208
     209    }
     210
    175211
    176212    /*void Jump::addPoints(int numPoints)
     
    191227        GSLevel::startMainMenu();
    192228    }*/
     229
     230    void Jump::addPlatform(float xPosition, float yPosition)
     231    {
     232                JumpPlatform* newPlatform = new JumpPlatform(center_->getContext());
     233                newPlatform->setPosition(Vector3(xPosition, yPosition, 0));
     234                platformList.push_front(newPlatform);
     235    }
     236
    193237}
Note: See TracChangeset for help on using the changeset viewer.