Advertisement Jump to content
Sign in to follow this  

xna resizing question

This topic is 3663 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
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){
}else if(Down Arrow Pressed){

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!