Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12128


Ignore:
Timestamp:
Nov 28, 2018, 12:06:14 PM (5 years ago)
Author:
ottka
Message:

Make two levels and more

Location:
code/branches/OrxoKart_HS18
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw

    r12116 r12128  
    11<LevelInfo
    2  name = "OrxoKart"
    3  description = "Level for Minigame OrxoKart"
     2 name = "OrxoKart Level 1"
     3 description = "Level 1 of Minigame OrxoKart"
    44 tags = "minigame"
    55 screenshot = "emptylevel.png"
     
    2020--number of tiles
    2121N = 11
    22 -- or 25
    2322--scaling factor
    2423S = 80
     24--level
     25L = 1
    2526
    2627MAP_ORIGIN = "0,0,0"
     
    4849          numCells="<?lua print(N)?>"
    4950          cellSize="<?lua print(S)?>"
    50           level=1
     51          level="<?lua print(L)?>"
    5152        />
    5253      </attached>
    5354
    5455      <collisionShapes>
     56       
     57       
    5558        <!-- in case of additional collisionShapes besides the floor -->
    5659      </collisionShapes>
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc

    r12116 r12128  
    4848
    4949        this->origin_ = nullptr;
    50         this->numberOfFlags_ = 1;
     50        this->raceFinished = false;
    5151        this->firstTick_ = true;
    5252
     
    108108            int *levelcodeArray =  level==1 ? map_1 : map_2;
    109109
     110
     111
     112            //OrxoKartTile* tile = new OrxoKartTile(origin_->getContext());
     113            //tile->init(0*s, 4*s, s, 20, 2);
     114
     115
    110116            // int z = 0;
    111117            //Generate floor according to levelcode
     
    114120                    if (int type = levelcodeArray[i*n + j]) {
    115121                        OrxoKartTile* tile = new OrxoKartTile(origin_->getContext());
    116                         tile->init((n-1-i)*s, j*s, s, type);
     122                        tile->init((n-1-i)*s, j*s, s, 0, type);
    117123                        // tiles.push_back(tile);
    118124                        //++z;
    119125                        if (level == 1) {
    120126                            //map 1
    121                             if ( i == 10 && j == 4 )
     127                            if ( i == 9 && j == 4 )
    122128                                wayPoints.at(0) = tile;
    123129
    124                             if ( i == 0 && j == 0)
     130                            if ( i == 0 && j == 1)
    125131                                wayPoints.at(1) = tile;
    126132                            if ( i == 10 && j == 7)
     
    129135                        else if (level == 2) {
    130136                            //map 2
    131                             if ( i == 24 && j == 11 )
     137                            if ( i == 23 && j == 11 )
    132138                                wayPoints.at(0) = tile;
    133139
    134                             if ( i == 0 && j == 0)
     140                            if ( i == 0 && j == 1)
    135141                                wayPoints.at(1) = tile;
    136142                            if ( i == 24 && j == 17)
     
    151157
    152158        } //firsttick end
    153         /*
    154         for (std::vector<OrxoKartTile*>::iterator it = tiles.begin(); it != tiles.end(); ++it ) {
    155             if ((*it)->getCollided())
    156                 tiles.erase(it);
    157         }
    158         if (tiles.empty())
    159             numberOfFlags_ = 0;
    160         */
     159       
    161160        if (wayPointCounter >= 3)
    162             numberOfFlags_ = 0;
     161            raceFinished = true;
     162
    163163        else if (wayPointCounter < 3 && wayPointCounter >= 0 && wayPoints.at(wayPointCounter) != nullptr) {
    164164            if (wayPoints.at(wayPointCounter)->getCollided()) {
     
    183183                player->setPosition(Vector3(s*0, 20, s*8));
    184184            if (level == 2)
    185                 player->setPosition(Vector3(s*0, 20, s*19));
     185                player->setPosition(Vector3(s*0, 20, s*18));
    186186            player->setOrientation(Quaternion(1, 0, 0, 0));   // 0, 0, 0
    187187            player->setVelocity(Vector3(0,0,0));
     
    190190            wayPointCounter = 0;
    191191
    192 
    193             // flag_->destroyLater();
    194            // flags_.erase (flags_.begin()+i);
    195             //numberOfFlags_ = 0;
    196192        }
    197193       
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h

    r12116 r12128  
    5555                { this->origin_ = origin; }
    5656
    57             inline int getNumberOfFlags() const
    58                 { return this->numberOfFlags_; }
     57            inline int getRaceFinished() const
     58                { return this->raceFinished; }
    5959
    6060        private:
     
    6565            std::vector<OrxoKartTile*> wayPoints;
    6666            int wayPointCounter = 0;
    67             int numberOfFlags_;
     67            bool raceFinished;
    6868            bool firstTick_;
    6969
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc

    r12111 r12128  
    8181        type of tile. 1 for normal tile, 2 for Start/End tile     
    8282    */
    83     void OrxoKartTile::init(int x, int z, int s, int type)
     83    void OrxoKartTile::init(int x, int z, int s, float r, int type)
    8484    {
    8585        // floor design according to its type
     
    9393        model_->setScale3D(Vector3(s*1.0f, 8.0f, s*1.0f));
    9494        model_->setPosition(Vector3(x*1.0f, 0.0f, z*1.0f));
     95        model_->pitch(Degree(r));
    9596
    9697        this->attach(model_);
     
    101102        cs_->setHalfExtents(Vector3(s/2.0f, 1.0f, s/2.0f));
    102103        cs_->setPosition(Vector3(x*1.0f, -1.0f, z*1.0f));
     104        cs_->pitch(Degree(r));
    103105
    104106        this->attachCollisionShape(cs_);
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h

    r12111 r12128  
    5050            virtual ~OrxoKartTile();
    5151
    52             void init(int x, int z, int s, int type);
     52            void init(int x, int z, int s, float r, int type);
    5353
    5454            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
  • code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.cc

    r12108 r12128  
    3232
    3333#include "TimeHUD.h"
     34
     35#include <iostream>
     36#include <fstream>
     37#include "Highscore.h"
    3438
    3539#include "core/CoreIncludes.h"
     
    8286        {
    8387            this->setCaption(getTimeString(this->time_));
    84             if (this->orxokartGame_->getNumberOfFlags() == 0)
     88            if (this->orxokartGame_->getRaceFinished()) {
    8589                setRunning(false);
     90                if (!score_set) {
     91                    std::ofstream highscoreFile;
     92                    highscoreFile.open("orxokart_highscores.txt", std::ios::app);
     93                    highscoreFile << "Name: " << getTimeString(this->time_) << std::endl;
     94                    highscoreFile.close();
     95                    score_set = true;
     96                }
     97            }
    8698        }
    8799       
  • code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.h

    r12074 r12128  
    3434
    3535#include "OrxoKartPrereqs.h"
     36#include <iostream>
     37#include <fstream>
    3638
    3739#include "tools/interfaces/Tickable.h"
     
    6163            float time_;
    6264            bool running_;
     65            bool score_set = false;
    6366    };
    6467}
Note: See TracChangeset for help on using the changeset viewer.