Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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.

File:
1 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);
Note: See TracChangeset for help on using the changeset viewer.