Open mcapraro opened 11 years ago
i changed StarlingCamera.as to have this on lines 210, 211:
_b.br = bounds.right - ( (_aabbData.offsetX+_aabbData.rect.width) - _b.rotoffset.x ) + (_aabbData.rect.width / 2);
_b.bb = bounds.bottom - ( (_aabbData.offsetY+_aabbData.rect.height) - _b.rotoffset.y) + (_aabbData.rect.height / 2);
and it gives me the desired behavior, just not sure what the original intention was so i wanted to run it by you
Hey @mcapraro , Everythings fine on my side.
tip for visualizing stuff:
put a flash sprite on stage, use the graphics api to draw the bounds rectangle and the camera rectangle and also in the state itself, I tend to have a starling sprite or some starling quads to visualize the corners of the bounds in game.
You don't have to setup bounds in setUp - you can set it to null in fact. I like less and less setUp, I'd like the camera to be simply there by default, just disabled, and we would just change whatever we want from it instead of writing this tedious function call everytime (cause offset is most often the center of the screen anyway, and camera lens argument is useless, bounds are not always used ...
So anyway I'd like to know more about the problem, if there is really something wrong and I can reproduce it easily, I'd have to debug when camera is zooming or rotating as well.
so far the only bug I know of now (been working on these cameras for long now) is that zooming out too fast can just produce unwanted results (seeing outside the bounds) and that's mostly due to the order in which I process the bounds collision and restrict the zooming ... it's a bit hard to figure out, there has been a lot of version of the cameras, if you found a bug that really doesn't allow us navigating inside the full bounds area, I really want to fix that !!!
thanks for the response @gsynuh what i am seeing in the multirez demo is that the Tiled tilemap is bound, so the camera exceeds all the sides by default. i took the TMX file in the repo and just drew a line of tiles around the perimeter.
however, if i create a bounds and pass it to the camera on setup like this:
var mapBounds:Rectangle = ((this.getObjectByName("Map Layer") as CitrusSprite).view as QuadBatch).bounds;
// you may need to pass a different map name as i changed it on my local machine
then the camera does honor the boundaries, except the left and bottom edges are not handled correctly (or so it seems).
i totally agree, it would be great o not have to supply any bounds and have the camera defaults do what is expected.
also, side topic: is there an even for when the hero falls off the bottom of the screen, or does one normally just set up a sensor to trigger when the hero has fallen?
hey there guys, so i am trying to make a level for the multirez demo and was wondering how the bounds system worked. i set the bounds to the Tiled map bounds and while i can see the upper left corner, i cannot see the right edge or bottom edge. my guess is that the bounds are being calculated as the rectangle i pass to camera.setUp minus the width and height of the camera viewport. how can i get it to see the whole map? also, should the camera be bounded by default? it seems more common to want the camera bounded to the map area than not.
i set the zoom of the camera to .75 in case that has anything to do with it