1
\$\begingroup\$

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.

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

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.

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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.

Scaling
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.

\$\endgroup\$

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