tags:

views:

261

answers:

2

I saw a silverlight animation at work. It was a server rack animation. This brought about a few questions:

If I have a big rectangle, which acts as a container, how can I code a rectangle to continuously drop down in smooth frames? You set the time elapsed in the storyboard and perhaps the new position of the rectangle which is dropping, but you can't write 400 tags for a 400px drop. Also, how is collision detection handled? Do I have to handle all that myself? E.g. if I was coding a tetris game, can shapes overlap each other or do they tesselate/stick?

1) What does "2*" mean in a row definition (more specifically, the *)? 1) I know how to do animation, but what is the difference between the types of animation (doubleAnimation/splineAnimation)? I can't find any information on the differences.

A: 

I would use the physics behaviors created by Peter Blois for Silverlight 3.

For a row definition, if you have two rows and one is * and the other is 2* then the 2* row is twice as high as the * row.

DoubleAnimation is a linear interpolation from one double value to another over a set time. The Spline animation goes over a user-defined curve to do ease-in/ease-out type behavior.

Michael S. Scherotter
A: 

I do find the answer from Michael interesting. For your reference, you might also want to check out the following blog regarding writing Silverlight Games.

http://www.bluerosegames.com/silverlight-games-101/post/Frame-Based-Sprite-Animation-in-Silverlight.aspx

I am currently using the BlueRose framework described in the blog. The framework provides a timer based method for updating Sprites. Sprites are related to Silverlight user controls. You can define your own rules for collision detection.

Check out the following link for a quick demo... http://screencast.com/t/if8xenkt

Michael Rosario
I'll check that out. Thanks
dotnetdev