- Timestamp:
- May 4, 2017, 3:17:59 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
r11405 r11412 55 55 speed_ = 0.0; 56 56 hasCollided_=false; 57 goesRight_ = true; 58 lastPos_ = getPosition(); 59 lastPos_.x -= 20; 60 changeAllowed_ = true; 61 changedOn_ = 0.0; 57 62 58 63 } … … 71 76 bool SOBMushroom::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 72 77 73 //orxout() << "Watshc bum baem" << endl; 78 79 if (changeAllowed_ && otherObject->getMass() != -1) { 80 goesRight_ = !goesRight_; 81 changeAllowed_ = false; 82 } 83 84 orxout() << "Watshc bum baem" << otherObject->getMass()<< endl; 74 85 return true; 75 86 } … … 90 101 SUPER(SOBMushroom, tick, dt); 91 102 92 Vector3 velocity = getVelocity(); 103 if (!changeAllowed_) { 104 changedOn_+= dt; 105 if (changedOn_> 200) { 106 changeAllowed_ = true; 107 changedOn_ = 0.0; 108 109 } 110 } 111 112 113 int dir = 1; 114 if (!goesRight_) 115 dir = -1; 116 117 Vector3 velocity = getVelocity(); 93 118 velocity.z -= gravityAcceleration_*dt; 94 velocity.x = speed_;119 velocity.x = dir*speed_; 95 120 setVelocity(velocity); 96 121 97 122 98 123 124 lastPos_ = getPosition(); 125 } 126 99 127 100 128 } 101 }
Note: See TracChangeset
for help on using the changeset viewer.