Skip to content

Commit

Permalink
FlxCamera: remove some (now) unnecessary zooming logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed Aug 21, 2016
1 parent e218192 commit c2cbb5b
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions Features/FlxCamera/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,7 @@ class PlayState extends FlxState

public function setZoom(zoom:Float)
{
zoom = FlxMath.bound(zoom, 0.5, 4);
FlxG.camera.zoom = zoom;

var zoomDistDiffY;
var zoomDistDiffX;

if (zoom <= 1)
{
zoomDistDiffX = Math.abs((LEVEL_MIN_X + LEVEL_MAX_X) - (LEVEL_MIN_X + LEVEL_MAX_X) / 1 + (1 - zoom));
zoomDistDiffY = Math.abs((LEVEL_MIN_Y + LEVEL_MAX_Y) - (LEVEL_MIN_Y + LEVEL_MAX_Y) / 1 + (1 - zoom));
zoomDistDiffX *= -.5;
zoomDistDiffY *= -.5;
}
else
{
zoomDistDiffX = Math.abs((LEVEL_MIN_X + LEVEL_MAX_X) - (LEVEL_MIN_X + LEVEL_MAX_X) / zoom);
zoomDistDiffY = Math.abs((LEVEL_MIN_Y + LEVEL_MAX_Y) - (LEVEL_MIN_Y + LEVEL_MAX_Y) / zoom);
zoomDistDiffX *= .5;
zoomDistDiffY *= .5;
}

FlxG.camera.setScrollBoundsRect(
LEVEL_MIN_X - zoomDistDiffX,
LEVEL_MIN_Y - zoomDistDiffY,
LEVEL_MAX_X + Math.abs(LEVEL_MIN_X) + zoomDistDiffX * 2,
LEVEL_MAX_Y + Math.abs(LEVEL_MIN_Y) + zoomDistDiffY * 2,
false);

FlxG.camera.zoom = FlxMath.bound(zoom, 0.5, 4);
hud.updateZoom(FlxG.camera.zoom);
}

Expand Down

0 comments on commit c2cbb5b

Please sign in to comment.