Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Check for collisions and move.
- // ------------------------------
- var collisionResult:CollisionResult;
- for (var i:int = levelRef.vecPolygons.length - 1; i >= 0; --i)
- {
- trace("na");
- collisionResult = levelRef.collisionDetector.checkCollision(collisionRect, levelRef.vecPolygons[i], velocity);
- if (!collisionResult)
- continue;
- if (collisionResult.willCollide)
- {
- // Polygons will collide after movement! Move the polygon by it's
- // velocity, then move the polygons appart using minTranslationVector.
- // -------------------------------------------------------------------
- velocity = velocity.add(collisionResult.minTranslationVector);
- break;
- }
- }
- trace("batman");
- x += velocity.x;
- y += velocity.y;
Add Comment
Please, Sign In to add comment