Guest User

Untitled

a guest
May 27th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Check for collisions and move.
  2. // ------------------------------
  3. var collisionResult:CollisionResult;
  4. for (var i:int = levelRef.vecPolygons.length - 1; i >= 0; --i)
  5. {
  6.     trace("na");
  7.     collisionResult = levelRef.collisionDetector.checkCollision(collisionRect, levelRef.vecPolygons[i], velocity);
  8.    
  9.     if (!collisionResult)
  10.         continue;
  11.        
  12.     if (collisionResult.willCollide)
  13.     {
  14.         // Polygons will collide after movement! Move the polygon by it's
  15.         // velocity, then move the polygons appart using minTranslationVector.
  16.         // -------------------------------------------------------------------
  17.         velocity = velocity.add(collisionResult.minTranslationVector);
  18.         break;
  19.     }
  20. }
  21. trace("batman");
  22. x += velocity.x;
  23. y += velocity.y;
Add Comment
Please, Sign In to add comment