Advertisement
bekovski

p13

Feb 5th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. /************************************************************************/
  2.         // Task P13.1a: Fill out this function
  3.         // Write the result to output->linear
  4.         // You can get the AI's position using character->Position
  5.         /************************************************************************/
  6.         Kore::vec2 direction = *target - character->Position;
  7.         direction.normalize();
  8.         output->linear = direction * maxAcceleration;
  9.  
  10.  
  11. /************************************************************************/
  12.         // Task P13.1b: Fill out this function
  13.         // Write the result to output->linear
  14.         // You can get the AI's position using character->Position
  15.         /************************************************************************/
  16.         Kore::vec2 direction = *target - character->Position;
  17.         direction.normalize();
  18.         output->linear = -(direction * maxAcceleration);
  19.  
  20.  
  21.  
  22. /************************************************************************/
  23.     // Task 13.2a: Complete this class so that it correctly returns
  24.     // Checks if the moon is closer or further away from the specified distance
  25.     /************************************************************************/
  26.     class MoonCondition : public Condition {
  27.     public:
  28.        
  29.         /**
  30.          * Performs the test for this condition.
  31.          */
  32.         virtual bool test() {
  33.             if (moon->Position.distance(earth->Position) < 1) {
  34.                 return true;
  35.             }
  36.  
  37.             return false;
  38.         }
  39.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement