Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9801


Ignore:
Timestamp:
Nov 21, 2013, 9:26:33 PM (10 years ago)
Author:
jo
Message:

Eridicating a Tetris Bug, related to the positioning of a TetrisBrick in case of a brick-bottom-collision.

Location:
code/trunk/src/modules/tetris
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/tetris/Tetris.cc

    r9795 r9801  
    5050#include "TetrisBrick.h"
    5151#include "infos/PlayerInfo.h"
     52#include <cmath>
    5253
    5354namespace orxonox
     
    210211        if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
    211212        {
    212             float yOffset = stone->getPosition().y + this->center_->getStoneSize()/2.0f;//calculate offset
     213            float baseOffset = abs(stone->getPosition().y);
     214            if (this->activeBrick_->getRotationCount() == 1 || this->activeBrick_->getRotationCount() == 3)
     215                baseOffset = abs(stone->getPosition().x);
     216            float yOffset = baseOffset + this->center_->getStoneSize()/2.0f;//calculate offset
    213217            if(yOffset < 0) //catch brake-throughs
    214218                yOffset = 0;
     
    388392        float xPos = (this->center_->getWidth()*1.6f + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
    389393        float yPos = (this->center_->getHeight()-5.1f)*this->center_->getStoneSize();
     394       
    390395        this->futureBrick_->setPosition(xPos, yPos, 0.0f);
    391396        this->futureBrick_->setGame(this);
  • code/trunk/src/modules/tetris/TetrisBrick.cc

    r9756 r9801  
    107107        {
    108108            stone->setPosition(0.0f, 0.0f, 0.0f);
     109            stone->setName("Base");
    109110        }
    110111        else if(i == 1)
    111112        {
    112113            stone->setPosition(0.0f, size_, 0.0f);
     114            stone->setName("Y");
    113115        }
    114116        else if(i == 2)
     
    117119            {
    118120                stone->setPosition(0.0f, 2*size_, 0.0f);
     121                stone->setName("2Y");
    119122            }
    120123            else if(this->shapeIndex_ == 3 || this->shapeIndex_ == 4|| this->shapeIndex_ == 5)
    121124            {
    122125                stone->setPosition(size_, 0, 0.0f);
     126                stone->setName("X");
    123127            }
    124128            else if(this->shapeIndex_ == 2)
    125129            {
    126130                stone->setPosition(-size_, 0, 0.0f);
     131                stone->setName("-X");
    127132            }
    128133        }
     
    132137            {
    133138                stone->setPosition(size_, size_, 0.0f);
     139                stone->setName("XY");
    134140            }
    135141            else if(this->shapeIndex_ == 1)
    136142            {
    137143                stone->setPosition(0, 3*size_, 0.0f);
     144                stone->setName("3Y");
    138145            }
    139146            else if(this->shapeIndex_ == 3 || this->shapeIndex_ == 7)
    140147            {
    141148                stone->setPosition(-size_, 0, 0.0f);
     149                stone->setName("-X");
    142150            }
    143151            else if(this->shapeIndex_ == 4)
    144152            {
    145153                stone->setPosition(-size_, size_, 0.0f);
     154                stone->setName("-XY");
    146155            }
    147156            else if(this->shapeIndex_ == 6)
    148157            {
    149158                stone->setPosition(size_, 0, 0.0f);
     159                stone->setName("X");
    150160            }
    151161        }
  • code/trunk/src/modules/tetris/TetrisScore.h

    r9667 r9801  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Johannes Ritz
    2424 *   Co-authors:
    2525 *      ...
Note: See TracChangeset for help on using the changeset viewer.