Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scaling to fake camera zoom effect?
I've been wondering how might a camera zooming effect, like the ones found in old 2D fighters, be done using sprite/tile scaling in Tilengine? What would be the proper way to incrementally increasing/decreasing the scale of tilemaps and sprites to fake a camera zooming in and out? Is that sort of thing possible with the current way scaling works in Tilengine?  

Any insight on this would be appreciated. 


Of course it's possible, but you have to coordinate the scaling of background and sprites. Broadly speaking, you must scale the sprite coordinates and their sizes by the same factor than background layer.

For example, you shrink the background to x0.5 and have sprite 0 at coordinates x=20, y=30 you must do:

TLN_SetSpritePosition(0, 20*0.5f, 30*0.5f);
TLN_SetSpriteScaling(0, 0.5f, 0.5f);

If you want a true NeoGeo-like experience, keep in mind that the NeoGeo can only shrink sprites, not enlarge. Artists drew the graphics at full size and the zooming effect is achieved by shrinking. Tilengine doesn't have this limitation, you can upscale too.

Forum Jump:

Users browsing this thread: 1 Guest(s)