I thought to try the following change: keep track of a sprite that happens to be in the exact center of the play area (call it centerWave) and then follow it by doing this after the above two lines of code:
dolphinCam.follow(centerWave, FlxCameraFollowStyle.LOCKON);
Surprisingly, this made no difference whatsoever to the outcome. I still have those exact same two problems.
Is there a way to do what I envision here with FlxCamera, or should I be looking at my own blitting code, or otherwise giving up the above idea? I was going for something quick and dirty, trying to do something I thought was more 'normal' than before so I wouldn't have to get into undebugged nether-usecases. Maybe it's nevertheless an undebugged nether-usercase to try to use a camera on something smaller than the screen, even if I'm going about it differently this time.
Thoughts?  Experience?  Help?  I'm aware that I could change the camera and scroll bounds each time I change the zoom, but for some reason I have an inkling that if what I imagine is intended to be doable with FlxCamera, then it would be a lot more straightforward than that.
Thanks,
GA
package;
import flixel.FlxCamera;import flixel.FlxG;import flixel.math.FlxRect;import flixel.util.FlxDestroyUtil;import openfl.Lib;
/** * A custom camera that handles zoom values of 1 and greater. */class CustomCamera extends FlxCamera{	/**	 * Boundary within which the camera can scroll / move around.	 * Covers stage dimensions by default.	 */	public var boundary : FlxRect;		/**	 * Horizontal length of screen cut off by zoom from top-left	 * corner to center of screen.	 */	public var dx : Float;		/**	 * Vertical length of screen cut off by zoom from top-left	 * corner to center of screen.	 */	public var dy : Float;		/**	 * Bounding box value. Furthest left point to scroll to.	 */	public var minX : Null<Float>;		/**	 * Bounding box value. Furthest right point to scroll to.	 */	public var maxX : Null<Float>;		/**	 * Bounding box value. Furthest top point to scroll to.	 */	public var minY : Null<Float>;		/**	 * Bounding box value. Furthest bottom point to scroll to.	 */	public var maxY : Null<Float>;		/**	 * Creates new camera and sets up the default boundary to cover	 * stage dimensions.	 * 	 * @param	x	X coordinate of origin, from top-left	 * @param	y	Y coordinate of origin, from top-left	 * @param	width	Width of camera viewport	 * @param	height	Height of camera viewport	 * @param	zoom	Zoom factor	 */	public function new(x : Int, y : Int, width : Int, height : Int, zoom : Float = 0) 	{		super(x, y, width, height, zoom);				adjustBounds(0, 0, Lib.current.stage.stageWidth, Lib.current.stage.stageHeight);		adjustZoom(zoom);	}		/**	 * Creates new camera from reference camera x, y, width, height,	 * and zoom values.	 * 	 * @param	c	Reference camera	 * @return	New camera	 */	public static inline function fromCamera(c : FlxCamera) : CustomCamera	{		return new CustomCamera(Std.int(c.x), Std.int(c.y), c.width, c.height, c.zoom);	}		/**	 * Shorthand for adjusting all bounding box values.	 * 	 * @param	minX	Furthest left point to scroll to	 * @param	minY	Furthest top point to scroll to	 * @param	maxX	Furthest right point to scroll to	 * @param	maxY	Furthest bottom point to scroll to	 */	public inline function adjustBounds(minX : Null<Float>, minY : Null<Float>, maxX : Null<Float>, maxY : Null<Float>) : Void	{		this.minX = minX;		this.minY = minY;		this.maxX = maxX;		this.maxY = maxY;	}		/**	 * Adjusts zoom and bounding box automatically.	 * 	 * @param	z	Zoom amount	 */	public function adjustZoom(z : Float) : Void	{		if (z < 1)		{			z = 1;		}				var factor = (z - 1) / (z * 2);		dx = FlxG.width * factor;		dy = FlxG.height * factor;				var x1 = minX == null ? null : minX - dx;		var y1 = minY == null ? null : minY - dy;		var x2 = maxX == null ? null : maxX + dx;		var y2 = maxY == null ? null : maxY + dy;				zoom = z;		setScrollBounds(x1, x2, y1, y2);	}		/**	 * Centers deadzone on target. Only works if target is set.	 */	public function deadzoneCenter() : Void	{		if (target != null)		{			this.deadzone.set(				(width - target.width) / 2,				(height - target.height) / 2,				target.width,				target.height			);		}	}		/**	 * Horizontally centered deadzone with an offset from top.	 * Only works if target is set.	 * @param	offset	Offset (in pixels)	 */	public function deadzoneOffsetY(offset : Float = 0) : Void	{		if (target != null)		{			this.deadzone.set(				(width - target.width) / 2,				dy + offset,				target.width,				target.height			);		}	}		/**	 * Vertically centered deadzone with an offset from left.	 * Only works if target is set.	 * @param	offset	Offset (in pixels)	 */	public function deadzoneOffsetX(offset : Float = 0) : Void	{		if (target != null)		{			this.deadzone.set(				dx + offset,				(height - target.height) / 2,				target.width,				target.height			);		}	}}// When creating the state
playerCamera = CustomCamera.fromCamera(FlxG.camera);
playerCamera.follow(playerSprite);
playerCamera.adjustBounds(0, 0, FlxG.width, FlxG.height);
playerCamera.adjustZoom(2);
FlxG.cameras.reset(playerCamera);hudCamera = new FlxCamera(0, 0, hud.width, hud.height, 0);hudCamera.follow(hud.background, FlxCameraFollowStyle.NO_DEAD_ZONE);hudCamera.bgColor = flixel.util.FlxColor.TRANSPARENT;FlxG.cameras.add(hudCamera);backdrop.cameras = [playerCamera];So, I go study the FlxCamera demo. It looks right when you run it, but how were these numbers figured out?
background = new FlxSprite(10000 -50, -175);
background.makeGraphic(300, 360, FlxColor.BLACK);
What? 10000...minus 50? Why minus 50? And how does -175 relate to anything? (Let alone, why would you need to offset it at all?) I guess it's the 360px-tall background graphic, minus 10 px...um...because that's how far the first text is offset from the top...divided by two...even though zoom = 1?
And why is it 300x360 when the hud cam is then 200x180?