updateBuffers() not working
-
Hi,
I'm trying to implement a zoom out, but for some reason, the map gets cut, and can't solve it by updating the buffers.
Basically, I do:
var cam:FlxCamera = FlxG.camera; _zoomCam = new FlxZoomCamera(Std.int(cam.x), Std.int(cam.y), cam.width, cam.height, cam.zoom); _zoomCam.follow(player, FlxCameraFollowStyle.TOPDOWN, 5); _zoomCam.zoomMargin = 1.3; _zoomCam.zoomSpeed = 2; // Reset the camera list by replacing the default cam with _zoomCam FlxG.cameras.reset(_zoomCam);
I'm using FlxTileMapExt (for slopes) and Tiled to do maps.
For other features, I can easily access the foreground tiles, but if I do:
var tilemap_foreground:FlxTilemap = cast(level.foregroundTiles.members[0], FlxTilemap); tilemap_foreground.updateBuffers();
And zoom out by doing
_zoomCam.targetZoom += -0.25;
I get this:Here's the whole level for reference:
Tweaking
FlxG.camera.setScrollBoundsRect
doesn't help either.I'm at the end of the rope here. Tried everything but not sure what I'm doing wrong.
Is there a way to solve this? Or to remove the fustrum altogether? Because also, the other sprites do disapear :( -- this wouldn't be a problem since the maps would be rather small.
Any info on this would be super appreciated. Thanks!
-
Well, I guess I solved the issue :)
Basically, what I did, was to extend 100 tiles the
UpdateColumns()
andUpdateRows()
onFlxTilemap
, also, changed theonScreen()
to alwaysreturn true
. This could cause performance issues, but it is only used on small maps, for versus mode, so... is OK in this case.Zoom out
Zoom in
Cheers!