- Timestamp:
- Nov 5, 2014, 4:06:09 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/JumpPlatformVMove.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformVMove.cc 31 @brief Implementation of the JumpPlatform class.31 @brief This platform can move vertically. 32 32 */ 33 33 34 34 #include "JumpPlatformVMove.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 39 37 #include "gametypes/Gametype.h" 40 41 38 #include "JumpFigure.h" 42 43 39 #include "sound/WorldSound.h" 44 40 #include "core/XMLPort.h" … … 48 44 RegisterClass(JumpPlatformVMove); 49 45 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 46 JumpPlatformVMove::JumpPlatformVMove(Context* context) : JumpPlatform(context) 55 47 { … … 59 51 } 60 52 61 /**62 @brief63 Destructor.64 */65 53 JumpPlatformVMove::~JumpPlatformVMove() 66 54 { … … 68 56 } 69 57 70 //xml port for loading sounds71 58 void JumpPlatformVMove::XMLPort(Element& xmlelement, XMLPort::Mode mode) 72 59 { … … 74 61 } 75 62 76 /**77 @brief78 Is called every tick.79 Handles the movement of the ball and its interaction with the boundaries and bats.80 @param dt81 The time since the last tick.82 */83 63 void JumpPlatformVMove::tick(float dt) 84 64 { … … 86 66 87 67 // Get the current position, velocity and acceleration of the ball. 88 Vector3 position = this->getPosition();89 Vector3 velocity = this->getVelocity();68 Vector3 position = getPosition(); 69 Vector3 velocity = getVelocity(); 90 70 91 71 if ((position.z < lowerBoundary_ && velocity.z < 0) || (position.z > upperBoundary_ && velocity.z > 0)) 92 72 { 93 //orxout() << "refelected platformVMove at " << position.z << endl;94 73 velocity.z = -velocity.z; 95 74 } 96 75 97 76 // Set the position, velocity and acceleration of the ball, if they have changed. 98 if (velocity != this->getVelocity()) 99 this->setVelocity(velocity); 100 if (position != this->getPosition()) 101 this->setPosition(position); 77 if (velocity != getVelocity()) 78 { 79 setVelocity(velocity); 80 } 81 if (position != getPosition()) 82 { 83 setPosition(position); 84 } 102 85 } 103 86 … … 107 90 upperBoundary_ = upperBoundary; 108 91 109 this->setVelocity(Vector3(0,0,speed));92 setVelocity(Vector3(0,0,speed)); 110 93 111 94 }
Note: See TracChangeset
for help on using the changeset viewer.