17 December 2009

XNA 2d animation

Added animation to pieces. They now glide from one square to another smoothly. At the start of the animation I make a note of the game time, so I know when the animation started. I add a second to calculate when it should end. Then I get the x and y coordinates of the start and end positions.

Then later on, in the display function, work out how far the piece should have moved between the start and end points given the current game time and display a piece at that location.

When the animation starts I make the call to move the piece so I have to display over the destination square with a sprite to show one fewer pieces than are actually there until the animation ends, when the moving piece arrives at it's destination.

The animation takes the same length of time no matter how far the piece is going to move, and the movement is linear, there is no easing into and out of the move. I am developing on a netbook, and I think the animation would be smoother on a desktop, but it looks pretty good.

15 December 2009

XNA, the fun bit

I worked on improving the graphics, creating help screens, realising that twiddling with images could extend indefinitely, so have made a list of things to change and will stop when it looks good enough. Also decided that I really must add some animation of pieces so that they glide from one position to another rather than teleporting.