Jump to content
  • Advertisement
Sign in to follow this  
Relixx

xna resizing question

This topic is 3501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Would anyone know how to go about making an image resize using keyboard input such as shrinking and growing ?

Share this post


Link to post
Share on other sites
Advertisement
Well, depending on what you mean this could be a way to go about doing it. Have to variables like:

int imageHeight = 800;
int imageWidth = 600;

Then for the keypress:

if(Up Arrow Pressed){
imageHeight--;
}else if(Down Arrow Pressed){
imageHeight++;
}

And so on. Then to draw it you'd do:

spriteBatch.Draw(image, new Rectangle(x,y, imageWidth, imageHeight), Color.White);

I think that is what you mean. If not just let me know. Or if you need the keyboard input in XNA explained.

Share this post


Link to post
Share on other sites
oh forgot to mention the grow / shrink is for the entire image. I was trying to make a image slowly shrink when the up arrow is pressed and slowly grow when the down arrow is pressed to give the illusion of my character walking off in the distance or moving up close to the screen.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!