Jump to content

issue with camera on scaled TilemapLayer


AlanSmithee
 Share

Recommended Posts

Hello.

 

I am tinkering with the blank tilemap example trying to scale down all layers "below" the current level.

This is working fine except that the camera bounds gets scaled with the level, clipping it before it reaches the actual bound of the world.

 

If you look at the attached files you will see the three different layers (scaled to 100%, 90% and 80%) as well as a red outline indicating the camerabounds for each layer.

 

I don't necessarily think this should be considered a bug and there is probably a setting for this but if so, I cannot find it :)

 

So my question is if there is a way to set the camera bounds per layer.

Or any other way to achive what I want (making all layers fill out the whole camera).

 

Thanks in advance. / AS

post-14081-0-10971000-1428834275.png

post-14081-0-48660300-1428834275.png

Link to comment
Share on other sites

So.. I've tried pretty much everything as far as settings and configuration is concerned. Ive tried changing everything and anything that I could possible think would affect this in the ScaleManager, TilemapLayer, Game and Camera, but nothing seems to affect this at all.

 

My next step will be to go over the phaser source to see what is actually limiting this, because even if it isn't a bug (I still consider the displayed behaviour to be the expected one), I can see situations where you would want to scale a tilemaplayer but still have it fill out the entire canvas.

 

Before I do that, I would like to ask again if anyone knows of an easy way (like a setting) that will allow me to scale a tilemaplayer but still have it fill out the entire canvas? (In practice scale the tiles and apply scrollfactor to tilemaplayer but leave the actual tilemaplayer dimensions intact (unscaled)).

 

If not, does anyone with more experience of the framework/codebase have any feedback as to if this is something that you would expect to be able to do or should I just drop it?

 

Thanks in advance / AS.

Link to comment
Share on other sites

Hello!

 

Sorry for bumping this thread again, but I thought it would be vise to conclude it in some way for any future reader that would happen upon it.

 

After digging through the phaser source code related to rendering a tilemaplayer and changing any variable that I thought could affect this I am yet to find anything that would allow for the desired behaviour. the only thing I can think of is that this is physically limited on a lower level (like PIXI) and I am not going to go that deep.

 

It is possible that this can be achived through manipulating the induvidual tile sizes rather than the tilemaplayer size, but since the scrollfactor etc. is per tilemaplayer, going down that route seems to be counter-productive.

 

I was unable to solve this, and since it is a "nice to have" feature rather than a "must" for me, I won't persue it any further. I did, however, come up with a nice compromise which works for me, and that is to add a cameraOffset of ((gamewidth - layerwidth) / 2) and ((gameheight - layerheight) / 2)  to the scaled down layers which makes them appear in the center with an "unvisible" border around them of equal size on all dimensions. This doesn't look nearly as ugly and I can now hide it by applying some overlay on the layers.

 

If any reader do find a good solution to the original problem please do share, othervise thanks for reading!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...