Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tetris/src/modules/tetris/TetrisStone.cc @ 8249

Last change on this file since 8249 was 8249, checked in by dafrick, 13 years ago

Re-adding tetris module.

File size: 2.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file TetrisStone.cc
31    @brief Implementation of the TetrisStone class.
32*/
33
34#include "TetrisStone.h"
35
36#include "core/CoreIncludes.h"
37#include "core/XMLPort.h"
38
39namespace orxonox
40{
41    CreateFactory(TetrisStone);
42
43    /**
44    @brief
45        Constructor. Registers and initializes the object.
46    */
47    TetrisStone::TetrisStone(BaseObject* creator) : ControllableEntity(creator)
48    {
49        RegisterObject(TetrisStone);
50       
51        this->size_ = 10.0f;
52        this->delay_ = false;
53        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
54    }
55
56    /**
57    @brief
58        Overloaded the function to rotate the stone.
59    @param value
60        A vector whose first component is the angle by which to rotate.
61    */
62    void TetrisStone::moveFrontBack(const Vector2& value)
63    {
64       
65    }
66
67    /**
68    @brief
69        Overloaded the function to steer the stone right and left
70    @param value
71        A vector whose first component is the direction in which we want to steer the stone.
72    */
73    void TetrisStone::moveRightLeft(const Vector2& value)
74    {
75        if(!this->delay_)
76        {
77            const Vector3& position = this->getPosition();
78            this->setPosition(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
79            this->delay_ = true;
80            this->delayTimer_.startTimer();
81        }
82    }
83
84    /**
85    @brief
86        Is called when the player changed.
87    */
88    void TetrisStone::changedPlayer()
89    {
90        this->setVelocity(0, 0, 0);
91    }
92}
Note: See TracBrowser for help on using the repository browser.