Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 3:06:08 PM (13 years ago)
Author:
catherine
Message:

Almost working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tetris/src/modules/tetris/TetrisStone.cc

    r8249 r8537  
    3737#include "core/XMLPort.h"
    3838
     39#include "Tetris.h"
     40
    3941namespace orxonox
    4042{
     
    5254        this->delay_ = false;
    5355        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
     56        this->previousPosition_ = Vector3::ZERO;
     57    }
     58
     59    void TetrisStone::tick(float dt)
     60    {
     61        SUPER(TetrisStone, tick, dt);
    5462    }
    5563
     
    7684        {
    7785            const Vector3& position = this->getPosition();
    78             this->setPosition(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
     86            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
     87            if(!this->tetris_->isValidMove(this, newPos))
     88                return;
     89
     90            //this->previousPosition_ = position;
     91            this->setPosition(newPos);
    7992            this->delay_ = true;
    8093            this->delayTimer_.startTimer();
Note: See TracChangeset for help on using the changeset viewer.