How to travel a certain pixel distance in XNA?

Janek1

New member
Joined
Jun 4, 2010
Messages
2
Reaction score
0
Points
1
This might not be the proper forum to ask this but I have a project for college and I basically need to make a sprite travel a certain set distance (in pixels). So far I only got it moving when I press the button but it stops as soon as I release the button. I need to push the button and then travel a certain distance.

So far I tried using a for loop in a method and as parameter input the distance it has to travel. Every time it goes through the loop it travels 1 pixel and adds 1 to a certain count and the for loop keeps looping until the count is equal or greater than the input distance. But the problem with this is that it goes too fast. Anybody knows what's the problem?

ty in advance. :)
 
Back
Top