Dynamic Scaling of Tiles

BlitzMax Forums/BlitzMax Programming/Dynamic Scaling of Tiles

Matt Vinyl(Posted 2007) [#1]
Afternoon all! :0)

I'm making a top-down multi-directional shooter / adventure hybrid (Anyone remember Mercenary? It's going to be very similar to that, but 3rd person / 2D).

I'm competent enough to get the scrolling up and running, and the realistic movement of my spacecraft.

That's the background - here's my question:

I'm going to be using a tiled wrap-around map for the 'floor' that the action takes place on. (Hence my other question regarding dynamic alpha!) I want my ship to be able to change it's altitude over the map. I can achieve this to some effect by scaling my ship sprite up and moving the shadow it makes appropriately. However, I'd really like to have the 'floor' appear to be shrinking away from the ship to some extent too. This at first sounded simple, just scale the tiles appropriate to how far away they are supposed to be. But this cales the tiles and leaves 'space' around the edge of each one - not the effect I was after! :) How would I go about scaling this effectively?

Some other useful info.:

- The players craft is 'locked' to the centre of the screen.

- The map is perfectly wrap-around, there are no edges. (I have a feeling this makes my problem more difficult!)

If I need to explain clearer, please let me know...

Cheers!


TaskMaster(Posted 2007) [#2]
When you "zoom out" and scaling the tiles down, you are effectively making more of them visible. So, instead of showing a grid of 30x30 tiles (or whatever) you will be showing 40x40 tiles (you will have to calculate this). Then you have to draw them closer together.

This is fairly simple if your ship stays in the middle of the screen. So your zoom point is constant.


Matt Vinyl(Posted 2007) [#3]
Yup, I get what you're saying, cheers! It's the co-ordinates thing th's throwing me. Also, you're right about the zoom point - that's why I locked the ship to the centre, it makes it a lot easier! I'll have to play around with it until I come to the best result I guess. Just not haaving much luck at the moment... :(


tonyg(Posted 2007) [#4]
Does this help?


Matt Vinyl(Posted 2007) [#5]
Hi Tonyg, looks promising, I'll have a read!

Cheers,
M.