Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 23, 2011, 12:13:34 PM (13 years ago)
Author:
dafrick
Message:

More documentation for Pong.

File:
1 edited

Legend:

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

    r5781 r8105  
    2727 */
    2828
     29/**
     30    @file PongBat.cc
     31    @brief Implementation of the PongBat class.
     32*/
     33
    2934#include "PongBat.h"
    3035
     
    3641    CreateFactory(PongBat);
    3742
     43    /**
     44    @brief
     45        Constructor. Registers and initializes the object.
     46    */
    3847    PongBat::PongBat(BaseObject* creator) : ControllableEntity(creator)
    3948    {
     
    5059    }
    5160
     61    /**
     62    @brief
     63        Registers variables to be synchronized over the network.
     64    */
    5265    void PongBat::registerVariables()
    5366    {
     
    5770    }
    5871
     72    /**
     73    @brief
     74        Is called each tick.
     75        //TODO detailed
     76    @param dt
     77        The time since last tick.
     78    */
    5979    void PongBat::tick(float dt)
    6080    {
     81        // If the bat is controlled (but not over the network).
    6182        if (this->hasLocalController())
    6283        {
    6384            if (this->movement_ != 0)
    6485            {
     86                // The absolute value of the movement is restricted to be lesser or equal than the speed of the bat.
    6587                this->movement_ = clamp(this->movement_, -1.0f, 1.0f) * this->speed_;
    6688
     89                //TODO What does this?
    6790                if (this->bMoveLocal_)
    6891                    this->setVelocity(this->getOrientation() * Vector3(this->movement_, 0, 0));
     
    84107        SUPER(PongBat, tick, dt);
    85108
     109        // Restrict the position of the bats, for them to always be between the upper and lower delimiters. i.e. the bats stall if they reach the upper or lower boundary.
    86110        Vector3 position = this->getPosition();
    87111        if (position.z > this->fieldHeight_ / 2 - this->fieldHeight_ * this->length_ / 2)
     
    96120    }
    97121
     122    /**
     123    @brief
     124        Overloaded the function to steer the bat up and down.
     125    @param value
     126        A vector whose first component is the inverse direction in which we want to steer the bat.
     127    */
    98128    void PongBat::moveFrontBack(const Vector2& value)
    99129    {
     
    102132    }
    103133
     134    /**
     135    @brief
     136        Overloaded the function to steer the bat up and down.
     137    @param value
     138        A vector whose first component is the direction in which we wnat to steer the bat.
     139    */
    104140    void PongBat::moveRightLeft(const Vector2& value)
    105141    {
     
    108144    }
    109145
     146    /**
     147    @brief
     148        Is called when the player changed.
     149    */
    110150    void PongBat::changedPlayer()
    111151    {
Note: See TracChangeset for help on using the changeset viewer.