Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just wondering if anyone can offer any advice on how best to go about creating a 2-D game with zooming/scaling features akin to the early Samurai Showdown games. In this case it would be a side scroller a la Metal Slug, the zooming would come in as more enemy sprites entered the screen, or when facing a large sized boss. A feature that would be both cosmetic as well as functional to the game.

I've done some reading and noticed a few suggestions that included drawing different sized sprites, a standard size and zoomed out size.

Any thoughts?

Thanks for your time.

share|improve this question

closed as not constructive by bummzack, Sean Middleditch, Trevor Powell, Josh Petrie, Byte56 Feb 20 '13 at 14:56

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

This is a "how to get started" question. We're expecting questions about actual problems that you face, check the faq. Voting to close. – Laurent Couvidou Jan 25 '13 at 11:43

I do know that using XNA, you can specify your target Rectangle for any texture that you import through the content pipe-line, and it'll zoom the texture to fit that size. So, rather than including, say, dozens of textures of different sizes that are otherwise identical, you could just use some technology like that for zooming purposes.

share|improve this answer

With any good 2d library you will be able to scale/zoom sprites, however you should be able to achieve what you want, simply by zooming the camera in and out.

share|improve this answer

You could have multiple sprites and swap once a sprite hits a target scale, but that seems unnecessary to me. You should design your sprites at their largest size, and zoom out accordingly. The only reason you'd need to swap out sprites at the smallest size is if you have a ton of detail which gets really distorted and ugly as you scale the sprite down. However, I think that your art should have the requirement of being able to be scaled easily without losing significant visual clarity.

Some technical considerations to keep in mind:

Collision Detection
If your collision detection is coupled with your sprite then the scaling shouldn't impact how collision functions. However, if you've decoupled your hitbox than make sure to update the hitbox size as you scale the sprites.

Since your scaling is going to be global, a basic camera class is a must. Remember, as you scale out your characters aren't the only things that will scale. The world will need to scale as well for the effect to look natural. Depending on where your registration is located on the sprite, zooming out will require some readjustment of the sprite's position. Make sure to keep track of a world position, and a screen position to make this easier on you.

I'm sure there are other considerations to take into account but these are the two that I would deem most important for a first pass of the system.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.