Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 19, 2015, 2:53:51 PM (10 years ago)
Author:
bucyril
Message:

Removed custom code

M hover/HoverShip.cc
M hover/HoverShip.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hoverHS15/src/modules/hover/HoverShip.cc

    r10659 r10661  
    4242    {
    4343        RegisterObject(HoverShip);
    44 
    45         speed = 830;
    46         isFireing = false;
    47         damping = 10;
    48 
    49         // not sure if has to be zero?
    50         lastTimeFront = 0;
    51         lastTimeLeft = 0;
    52         lastTime = 0;
    5344    }
    5445
    5546    void HoverShip::tick(float dt)
    5647    {
    57         Vector3 pos = getPosition();
    58 
    59         //Movement calculation
    60         lastTimeFront += dt * damping;
    61         lastTimeLeft += dt * damping;
    62         lastTime += dt;
    63 
    64         velocity.x = interpolate(clamp(lastTimeLeft, 0.0f, 1.0f), desiredVelocity.x, 0.0f);
    65         velocity.y = interpolate(clamp(lastTimeFront, 0.0f, 1.0f), desiredVelocity.y, 0.0f);
    66 
    67         //Execute movement
    68         if (this->hasLocalController())
    69         {
    70             float dist_y = velocity.y * dt;
    71             //float dist_x = velocity.x * dt;
    72             if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)
    73                 posforeward += dist_y;
    74             else
    75             {
    76                 velocity.y = 0;
    77                 // restart if game ended
    78 /*
    79                 if (getGame())
    80                     if (getGame()->bEndGame)
    81                     {
    82                         getGame()->start();
    83                         return;
    84                     }*/
    85             }
    86 
    87             pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
    88         }
    89 
    90 
    91         // Camera
    92         Camera* camera = this->getCamera();
    93         if (camera != NULL)
    94         {
    95             // camera->setPosition(Vector3(-pos.z, -posforeward, 0));
    96             camera->setOrientation(Vector3::UNIT_Z, Degree(0));
    97         }
    98 
    99 
    100 
    101         // bring back on track!
    102         if(pos.y != 0)
    103         {
    104             pos.y = 0;
    105         }
    106 
    107         setPosition(pos);
    108         setOrientation(Vector3::UNIT_Y, Degree(270));
    109 
    110         // Level up!
    111         if (pos.x > 42000)
    112         {
    113             updateLevel();
    114             setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)
    115         }
    116 
    11748        SUPER(HoverShip, tick, dt);
    118     }
    119 
    120     void HoverShip::updateLevel()
    121     {
    122         lastTime = 0;
    123         if (getGame())
    124             getGame()->levelUp();
    125     }
    126 
    127     void HoverShip::moveFrontBack(const Vector2& value)
    128     {
    129         //lastTimeFront = 0;
    130         //desiredVelocity.y = value.y * speed * 42;
    131 
    132     }
    133 
    134     void HoverShip::moveRightLeft(const Vector2& value)
    135     {
    136         lastTimeLeft = 0;
    137         desiredVelocity.x = value.x * speed;
    138     }
    139     void HoverShip::boost(bool bBoost)
    140     {
    141         //getGame()->bEndGame = bBoost;
    142     }
    143 
    144     inline bool HoverShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    145     {
    146 
    147         removeHealth(100);
    148         this->death();
    149         return false;
    15049    }
    15150
    15251    Hover* HoverShip::getGame()
    15352    {
    154         if (game == NULL)
     53        /*if (game == NULL)
    15554        {
    15655            for (ObjectList<Hover>::iterator it = ObjectList<Hover>::begin(); it != ObjectList<Hover>::end(); ++it)
     
    15958            }
    16059        }
    161         return game;
    162     }
    163 
    164     void HoverShip::death()
    165     {
    166         getGame()->costLife();
    167         SpaceShip::death();
     60        return game;*/
    16861    }
    16962}
Note: See TracChangeset for help on using the changeset viewer.