Geeks With Blogs
Prabhu Kumar a tech twaddler..

Well, yesterday night I was watching a tutorial on XNA when I came across this neat little trick. It was a simple XNA application with a Windows Phone logo in it and whenever the user clicked on the device the logo would move towards the click point, and I couldn't resist experimenting with the marble (;

The code is written in C# using CF3.5. Here is a video of the demo,


You probably noticed the motion of the marble towards the click point (destination). The marble starts off with a high velocity and slows down as it reaches its destination. This is achieved by making the speed of the marble a function of the distance between marble's current position and the destination, so as the marble approaches the destination point, the distance between them reduces and so does the speed, until it becomes zero.

More on the code and the logic behind it in the next post. What I'd like to do next is, instead of making the marble stop at the click point, it should continue to move beyond it, bounce around the screen a few times and eventually come to a stop after a while. Let's see how that goes.

Posted on Thursday, May 6, 2010 6:24 AM General | Back to top

Comments on this post: Applications: Some more marble fun!

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © TechTwaddle | Powered by: