Layer Transparency and Zooming out

Jan 2, 2012 at 4:33 PM

 

Thanks for the excellent library

 

the ability to zoom in and out of the map in game would be pretty useful

if you could add another overload to the Map.Draw that takes a Matrix

then pass that through to  BeginScene

such as

    public void BeginScene(Matrix transformation)
        {
            m_spriteBatchAlpha.Begin(SpriteSortMode.DeferredBlendState.AlphaBlend,null ,null,null,null,transformation);
            m_spriteBatchAdditive.Begin(SpriteSortMode.DeferredBlendState.Additivenullnullnullnulltransformation);
        }

 this should be able to handle the zooming in and out

Of course this maybe implemented already and i may just be missing it!

 I would be happy to make these changes myself although im having issues with the xTileSignature key

 

 

 

also it would be great if we could set layer Transparency in code (although i'm thinking this may be possible by changing the Spritesheet ingame to one with a preset transparency)

 

also i was wondering if you had any pointers on Tiling Maps (i.e. loading two maps Simultaneously so that i can view them side by side and walk from one to the other)

Im struggling to see how this could be possible currently

 

 

 

 

 

 

 

 

Jan 5, 2012 at 8:59 AM

actually i have been playing around with some of the source code and have gotten all of this sorted myself now thank you

Coordinator
Jan 5, 2012 at 9:42 AM
Edited Jan 5, 2012 at 9:49 AM

I'm glad you found a workaround to implement scaling. I have considered this as well but there are some issues to tackle, such as how to handle the viewport. For instance, if you double the scale, should the viewport stay the same absolute size and display half as many tiles across and down? or should it scale accordingly and simply show all the tiles as in the case of the scale being 100% ?

With regards to the transparency feature, I'm not sure what you mean. Tiles are either alpha or additively blended by the engine depending on the blending property in each tile (Alpha by default). This also means that if they have an alpha channel, the tile transparency will be applied to the blending process. You can perhaps have a copy of the tile sheet image with no alpha channel or an image with an alpha channel that is all opaque. If I may ask, why do you need to alter the transparency at runtime in this manner?

Jan 9, 2012 at 9:50 AM
Edited Jan 9, 2012 at 10:48 AM

I use the Tile set to create some fairly high rise towers, however i want to see myself when i walk behind them so set the Tilesheet to a copy but at 25% opaqueness(sp?) the effect is quite nice actually

 

In regard to the scaling thing sadly my idea above stopped working because of the very reasons you outlined shame!

 

 

Coordinator
Jan 9, 2012 at 8:13 PM

You could have two layers of the same size containing an exact copy of the towers except that the one at the back uses the opaque tilesheet while the one in front uses the 20% opaque version. The towers will appear opaque, but if you render the player between the layers, it would be partially shaded by the front layer, without the whole layer becoming partially transparent to the viewer.

Apr 11, 2012 at 4:55 PM

I'm facing a similar issue as Yakyb, in the sense that I need to be able to scale the tiles to 2x.  I figured I'd reply to this topic, instead of starting another topic on the same issue.  Would you(Yakyb) mind sharing what you did to allow for scaling matrices?