Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12089


Ignore:
Timestamp:
Nov 7, 2018, 11:42:26 AM (5 years ago)
Author:
ottka
Message:

implement module

Location:
code/branches/OrxoKart_HS18
Files:
4 edited

Legend:

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

    r12081 r12089  
    6161
    6262        <!-- floor design -->
    63        
     63        <!--
    6464        <Model
    6565          position="<?lua print((N-1)*S/2)?>,0,<?lua print((N-1)*S/2)?>"
     
    6868          mesh="teststrecke.mesh"
    6969        />
    70      
     70      -->
    7171       
    7272      </attached>
     
    8181        <!-- floor physics -->
    8282
    83 <!-- tile number 0-->
    84 <BoxCollisionShape
    85 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(0*S) ?>"
    86 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    87 />
    88 <!-- tile number 1-->
    89 <BoxCollisionShape
    90 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(1*S) ?>"
    91 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    92 />
    93 <!-- tile number 2-->
    94 <BoxCollisionShape
    95 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(2*S) ?>"
    96 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    97 />
    98 <!-- tile number 3-->
    99 <BoxCollisionShape
    100 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(3*S) ?>"
    101 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    102 />
    103 <!-- tile number 4-->
    104 <BoxCollisionShape
    105 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(4*S) ?>"
    106 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    107 />
    108 <!-- tile number 5-->
    109 <BoxCollisionShape
    110 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(5*S) ?>"
    111 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    112 />
    113 <!-- tile number 6-->
    114 <BoxCollisionShape
    115 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(6*S) ?>"
    116 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    117 />
    118 <!-- tile number 7-->
    119 <BoxCollisionShape
    120 position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(7*S) ?>"
    121 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    122 />
    123 <!-- tile number 8-->
    124 <BoxCollisionShape
    125 position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(0*S) ?>"
    126 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    127 />
    128 <!-- tile number 9-->
    129 <BoxCollisionShape
    130 position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(7*S) ?>"
    131 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    132 />
    133 <!-- tile number 10-->
    134 <BoxCollisionShape
    135 position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(8*S) ?>"
    136 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    137 />
    138 <!-- tile number 11-->
    139 <BoxCollisionShape
    140 position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(9*S) ?>"
    141 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    142 />
    143 <!-- tile number 12-->
    144 <BoxCollisionShape
    145 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(0*S) ?>"
    146 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    147 />
    148 <!-- tile number 13-->
    149 <BoxCollisionShape
    150 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(2*S) ?>"
    151 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    152 />
    153 <!-- tile number 14-->
    154 <BoxCollisionShape
    155 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(3*S) ?>"
    156 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    157 />
    158 <!-- tile number 15-->
    159 <BoxCollisionShape
    160 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(4*S) ?>"
    161 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    162 />
    163 <!-- tile number 16-->
    164 <BoxCollisionShape
    165 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(5*S) ?>"
    166 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    167 />
    168 <!-- tile number 17-->
    169 <BoxCollisionShape
    170 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(9*S) ?>"
    171 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    172 />
    173 <!-- tile number 18-->
    174 <BoxCollisionShape
    175 position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(10*S) ?>"
    176 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    177 />
    178 <!-- tile number 19-->
    179 <BoxCollisionShape
    180 position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(0*S) ?>"
    181 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    182 />
    183 <!-- tile number 20-->
    184 <BoxCollisionShape
    185 position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(1*S) ?>"
    186 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    187 />
    188 <!-- tile number 21-->
    189 <BoxCollisionShape
    190 position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(2*S) ?>"
    191 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    192 />
    193 <!-- tile number 22-->
    194 <BoxCollisionShape
    195 position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(5*S) ?>"
    196 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    197 />
    198 <!-- tile number 23-->
    199 <BoxCollisionShape
    200 position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(6*S) ?>"
    201 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    202 />
    203 <!-- tile number 24-->
    204 <BoxCollisionShape
    205 position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(10*S) ?>"
    206 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    207 />
    208 <!-- tile number 25-->
    209 <BoxCollisionShape
    210 position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(6*S) ?>"
    211 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    212 />
    213 <!-- tile number 26-->
    214 <BoxCollisionShape
    215 position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(8*S) ?>"
    216 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    217 />
    218 <!-- tile number 27-->
    219 <BoxCollisionShape
    220 position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(9*S) ?>"
    221 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    222 />
    223 <!-- tile number 28-->
    224 <BoxCollisionShape
    225 position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(10*S) ?>"
    226 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    227 />
    228 <!-- tile number 29-->
    229 <BoxCollisionShape
    230 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(0*S) ?>"
    231 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    232 />
    233 <!-- tile number 30-->
    234 <BoxCollisionShape
    235 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(1*S) ?>"
    236 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    237 />
    238 <!-- tile number 31-->
    239 <BoxCollisionShape
    240 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(2*S) ?>"
    241 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    242 />
    243 <!-- tile number 32-->
    244 <BoxCollisionShape
    245 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(3*S) ?>"
    246 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    247 />
    248 <!-- tile number 33-->
    249 <BoxCollisionShape
    250 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(4*S) ?>"
    251 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    252 />
    253 <!-- tile number 34-->
    254 <BoxCollisionShape
    255 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(5*S) ?>"
    256 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    257 />
    258 <!-- tile number 35-->
    259 <BoxCollisionShape
    260 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(6*S) ?>"
    261 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    262 />
    263 <!-- tile number 36-->
    264 <BoxCollisionShape
    265 position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(8*S) ?>"
    266 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    267 />
    268 <!-- tile number 37-->
    269 <BoxCollisionShape
    270 position="<?lua print((N-1-6)*S) ?>,-1, <?lua print(0*S) ?>"
    271 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    272 />
    273 <!-- tile number 38-->
    274 <BoxCollisionShape
    275 position="<?lua print((N-1-6)*S) ?>,-1, <?lua print(8*S) ?>"
    276 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    277 />
    278 <!-- tile number 39-->
    279 <BoxCollisionShape
    280 position="<?lua print((N-1-7)*S) ?>,-1, <?lua print(0*S) ?>"
    281 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    282 />
    283 <!-- tile number 40-->
    284 <BoxCollisionShape
    285 position="<?lua print((N-1-7)*S) ?>,-1, <?lua print(8*S) ?>"
    286 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    287 />
    288 <!-- tile number 41-->
    289 <BoxCollisionShape
    290 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(0*S) ?>"
    291 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    292 />
    293 <!-- tile number 42-->
    294 <BoxCollisionShape
    295 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(1*S) ?>"
    296 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    297 />
    298 <!-- tile number 43-->
    299 <BoxCollisionShape
    300 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(2*S) ?>"
    301 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    302 />
    303 <!-- tile number 44-->
    304 <BoxCollisionShape
    305 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(3*S) ?>"
    306 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    307 />
    308 <!-- tile number 45-->
    309 <BoxCollisionShape
    310 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(4*S) ?>"
    311 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    312 />
    313 <!-- tile number 46-->
    314 <BoxCollisionShape
    315 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(8*S) ?>"
    316 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    317 />
    318 <!-- tile number 47-->
    319 <BoxCollisionShape
    320 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(9*S) ?>"
    321 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    322 />
    323 <!-- tile number 48-->
    324 <BoxCollisionShape
    325 position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(10*S) ?>"
    326 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    327 />
    328 <!-- tile number 49-->
    329 <BoxCollisionShape
    330 position="<?lua print((N-1-9)*S) ?>,-1, <?lua print(4*S) ?>"
    331 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    332 />
    333 <!-- tile number 50-->
    334 <BoxCollisionShape
    335 position="<?lua print((N-1-9)*S) ?>,-1, <?lua print(10*S) ?>"
    336 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    337 />
    338 <!-- tile number 51-->
    339 <BoxCollisionShape
    340 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(4*S) ?>"
    341 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    342 />
    343 <!-- tile number 52-->
    344 <BoxCollisionShape
    345 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(5*S) ?>"
    346 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    347 />
    348 <!-- tile number 53-->
    349 <BoxCollisionShape
    350 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(6*S) ?>"
    351 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    352 />
    353 <!-- tile number 54-->
    354 <BoxCollisionShape
    355 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(7*S) ?>"
    356 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    357 />
    358 <!-- tile number 55-->
    359 <BoxCollisionShape
    360 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(8*S) ?>"
    361 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    362 />
    363 <!-- tile number 56-->
    364 <BoxCollisionShape
    365 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(9*S) ?>"
    366 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    367 />
    368 <!-- tile number 57-->
    369 <BoxCollisionShape
    370 position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(10*S) ?>"
    371 halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
    372 />
     83
    37384
    37485
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc

    r12079 r12089  
    6161            this->firstTick_ = false;
    6262
    63             int numCells = this->origin_->getNumCells();
    64             int cellSize = this->origin_->getCellSize();
     63            int n = this->origin_->getNumCells();
     64            int s = this->origin_->getCellSize();
    6565            int cellHeight = this->origin_->getCellHeight();
    6666
     
    7575                                    ,1,1,1,1,1,0,0,0,1,1,1
    7676                                    ,0,0,0,0,1,0,0,0,0,0,1
    77                                     ,0,0,0,0,1,1,1,1,1,1,1};
     77                                    ,0,0,0,0,1,1,1,2,1,1,1};
    7878            int* levelcode = levelcodeArray;
    7979
    80             //Outer Walls
    81             for(int i = 0; i<numCells; i++){
    82                 (new OrxoKartTile(origin_->getContext()))->init(0,        i+1,      cellSize, cellHeight, 1);
    83                 (new OrxoKartTile(origin_->getContext()))->init(numCells, i+1,      cellSize, cellHeight, 1);
    84                 (new OrxoKartTile(origin_->getContext()))->init(i+1,      0,        cellSize, cellHeight, 2);
    85                 (new OrxoKartTile(origin_->getContext()))->init(i+1,      numCells, cellSize, cellHeight, 2);
    86             }
    8780
    88             //Generate inner Walls according to levelcode
    89             for(int y=0; y<numCells; y++){
    90                 for(int x=0; x<numCells; x++){
    91                     switch(levelcode[ y * numCells + x ]){
    92                         case 1: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
    93                                 break;
    94                         case 3: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
    95                         case 2: (new OrxoKartTile(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
    96                         default: break;
    97                     }
     81            //Generate floor according to levelcode
     82            for(int i=0; i<n; i++){
     83                for(int j=0; j<n; j++){
     84                    if (int type = levelcodeArray[i*n + j])
     85                    (new OrxoKartTile(origin_->getContext()))->init((n-1-i)*s, j*s, s, type);
    9886                }   
    9987            }
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc

    r12062 r12089  
    8383            Wall on the right side (1) or on top (2) of this square, 0-1       
    8484    */
    85     void OrxoKartTile::init(int x, int y, int cellSize, int cellHeight, int orientation)
     85    void OrxoKartTile::init(int x, int z, int s, int type)
    8686    {
     87        model_ = new Model(this->getContext());
     88        if (type == 1) {
     89           model_->setMeshSource("OrxoKartStreckenabschnitt.mesh");
     90        }
     91        else if (type == 2 ) {
     92            model_->setMeshSource("OrxoKartStreckenabschnittZiel.mesh");
     93        }
     94        model_->setScale3D(Vector3(s*1.0f, 8.0f, s*1.0f));
     95        model_->setPosition(Vector3(x*1.0f, 0.0f, z*1.0f));
     96
     97        this->attach(model_);
     98
     99        cs_ = new BoxCollisionShape(this->getContext());
     100        cs_->setHalfExtents(Vector3(s/2.0f, 1.0f, s/2.0f));
     101        cs_->setPosition(Vector3(x*1.0f, -1.0f, z*1.0f));
     102
     103        this->attachCollisionShape(cs_);
     104
     105        /*
     106
    87107        int xSize_, zSize_, xPos_, zPos_;
    88108
     
    113133
    114134        this->attachCollisionShape(cs_);
     135        */
    115136    }
    116137}
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h

    r12062 r12089  
    4949            virtual ~OrxoKartTile();
    5050
    51             void init(int x, int y, int cellSize, int cellHeight, int orientation);
     51            void init(int x, int z, int s, int type);
    5252
    5353        private:
Note: See TracChangeset for help on using the changeset viewer.