Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: Objective C | Size: 3.32 KB | Hits: 55 | Expires: Never
Copy text to clipboard
  1. CGPoint velocity = leftJoystick.velocity;
  2.        
  3.         const float crosshairScale = 360.0f;
  4.         float vxCrosshair = crosshairScale * velocity.x;
  5.         float vyCrosshair = crosshairScale * velocity.y;
  6.        
  7.         const float bgScale = 48.0f;
  8.         float vxBg = bgScale * velocity.x;
  9.         float vyBg = bgScale * velocity.y;
  10.        
  11.         const float targetScale1 = 16.0f;
  12.         float vxTargetRow1 = targetScale1 * velocity.x;
  13.         float vyTargetRow1 = targetScale1 * velocity.y;
  14.        
  15.         const float targetScale2 = 24.0f;
  16.         float vxTargetRow2 = targetScale2 * velocity.x;
  17.         float vyTargetRow2 = targetScale2 * velocity.y;
  18.        
  19.         const float targetScale3 = 32.0f;
  20.         float vxTargetRow3 = targetScale3 * velocity.x;
  21.         float vyTargetRow3 = targetScale3 * velocity.y;
  22.        
  23.         const float targetScale4 = 40.0f;
  24.         float vxTargetRow4 = targetScale4 * velocity.x;
  25.         float vyTargetRow4 = targetScale4 * velocity.y;
  26.        
  27.         const float targetScale5 = 48.0f;
  28.         float vxTargetRow5 = targetScale5 * velocity.x;
  29.         float vyTargetRow5 = targetScale5 * velocity.y;
  30.        
  31.         float xCrosshair = crosshair.position.x + vxCrosshair * delta;
  32.         float yCrosshair = crosshair.position.y + vyCrosshair * delta;
  33.        
  34.         float xBg = background.position.x + vxBg * delta;
  35.         float yBg = background.position.y + vyBg * delta;
  36.        
  37.         float xTargetRow1 = targetRow1.position.x + vxTargetRow1 * delta;
  38.         float yTargetRow1 = targetRow1.position.y + vyTargetRow1 * delta;
  39.         float xTargetRow2 = targetRow2.position.x + vxTargetRow2 * delta;
  40.         float yTargetRow2 = targetRow2.position.y + vyTargetRow2 * delta;
  41.         float xTargetRow3 = targetRow3.position.x + vxTargetRow3 * delta;
  42.         float yTargetRow3 = targetRow3.position.y + vyTargetRow3 * delta;
  43.         float xTargetRow4 = targetRow4.position.x + vxTargetRow4 * delta;
  44.         float yTargetRow4 = targetRow4.position.y + vyTargetRow4 * delta;
  45.         float xTargetRow5 = targetRow5.position.x + vxTargetRow5 * delta;
  46.         float yTargetRow5 = targetRow5.position.y + vyTargetRow5 * delta;
  47.        
  48.         xCrosshair = MAX(32.0f, xCrosshair);
  49.     xCrosshair = MIN(448.0f, xCrosshair);
  50.     yCrosshair = MAX(32.0f, yCrosshair);
  51.     yCrosshair = MIN(288.0f, yCrosshair);
  52.        
  53.         xBg = MAX(210.0f, xBg);
  54.         xBg = MIN(270.0f, xBg);
  55.         yBg = MAX(120.0f, yBg);
  56.         yBg = MIN(200.0f, yBg);
  57.        
  58.         xTargetRow1 = MAX(-16.0f, xTargetRow1);
  59.         xTargetRow1 = MIN(16.0f, xTargetRow1);
  60.         yTargetRow1 = MAX(0.0f, yTargetRow1);
  61.         yTargetRow1 = MIN(16.0f, yTargetRow1);
  62.        
  63.         xTargetRow2 = MAX(-24.0f, xTargetRow2);
  64.         xTargetRow2 = MIN(24.0f, xTargetRow2);
  65.         yTargetRow2 = MAX(32.0f, yTargetRow2);
  66.         yTargetRow2 = MIN(56.0f, yTargetRow2);
  67.        
  68.         xTargetRow3 = MAX(-32.0f, xTargetRow3);
  69.         xTargetRow3 = MIN(32.0f, xTargetRow3);
  70.         yTargetRow3 = MAX(64.0f, yTargetRow3);
  71.         yTargetRow3 = MIN(96.0f, yTargetRow3);
  72.        
  73.         xTargetRow4 = MAX(-40.0f, xTargetRow4);
  74.         xTargetRow4 = MIN(40.0f, xTargetRow4);
  75.         yTargetRow4 = MAX(92.0f, yTargetRow4);
  76.         yTargetRow4 = MIN(132.0f, yTargetRow4);
  77.        
  78.         xTargetRow5 = MAX(-48.0f, xTargetRow5);
  79.         xTargetRow5 = MIN(48.0f, xTargetRow5);
  80.         yTargetRow5 = MAX(128.0f, yTargetRow5);
  81.         yTargetRow5 = MIN(176.0f, yTargetRow5);
  82.        
  83.         crosshair.position = ccp(xCrosshair,yCrosshair);
  84.         background.position = ccp(xBg,yBg);
  85.         targetRow1.position = ccp(xTargetRow1, yTargetRow1);
  86.         targetRow2.position = ccp(xTargetRow2, yTargetRow2);
  87.         targetRow3.position = ccp(xTargetRow3, yTargetRow3);
  88.         targetRow4.position = ccp(xTargetRow4, yTargetRow4);
  89.         targetRow5.position = ccp(xTargetRow5, yTargetRow5);