Silverlight Game Development Study Notes (1)

Source: Internet
Author: User

I. Three animations in Silverlight:
The creation of storyboard animations must depend on the associated attributes (dependency attributes) to provide a solution for creating a series of highly continuously changing animations, and even implement more complex keyframe animations.

Compositiontarget animation is suitable for changing the time attribute when the global screen is refreshed, such as game loop.

Dispatchertimer animation is very suitable for the use of the object's own motion animation, such as the movement of the genie, combat, cast action, magic play animation, and so on.

Ii. "Eight orientations" Algorithm
/// <Summary>
/// Calculate the tangent between the current coordinate and the target point to obtain the orientation
/// </Summary>
/// <Param name = "current"> current coordinate </param>
/// <Param name = "target"> Target coordinate </param>
/// <Returns> orientation code 0, 1, 2, 3, 4, 5, 6, and 7 </returns>
Public int getdirection (Point Current, Point Target ){
Double tan = (target. Y-current. Y)/(target. X-current. X );
If (math. Abs (TAN)> = math. Tan (math. Pi * 3/8) & target. Y <= current. Y ){
Return 0;
} Else if (math. ABS (TAN)> math. tan (math. PI/8) & math. ABS (TAN) <math. tan (math. pI * 3/8) & target. x> current. X & target. Y <Current. Y ){
Return 1;
} Else if (math. Abs (TAN) <= math. Tan (math. PI/8) & target. x> = current. X ){
Return 2;
} Else if (math. ABS (TAN)> math. tan (math. PI/8) & math. ABS (TAN) <math. tan (math. pI * 3/8) & target. x> current. X & target. y> current. Y ){
Return 3;
} Else if (math. Abs (TAN)> = math. Tan (math. Pi * 3/8) & target. Y> = current. Y ){
Return 4;
} Else if (math. ABS (TAN)> math. tan (math. PI/8) & math. ABS (TAN) <math. tan (math. pI * 3/8) & target. x <Current. X & target. y> current. Y ){
Return 5;
} Else if (math. Abs (TAN) <= math. Tan (math. PI/8) & target. x <= current. X ){
Return 6;
} Else if (math. ABS (TAN)> math. tan (math. PI/8) & math. ABS (TAN) <math. tan (math. pI * 3/8) & target. x <Current. X & target. Y <Current. Y ){
Return 7;
} Else {
Return 0;
}
}

Iii. Understanding of Velocity Coefficient
Understanding of the speed coefficient.
Mathematical formula: S = V * t
Here (k is the speed coefficient): S * k = T. In this case, S/T = 1/K. That is, V = 1/K. The time when the distance is multiplied by the coefficient.
In this way, the larger the speed coefficient, the smaller the moving distance per unit time (speed), and the slower the object motion.
Let's look at this formula: S * k = T. Is the greater the coefficient "K", the larger the time "T" is used. "S" is a long time away, and the speed is naturally slow.

 

Friend, if you have any insights, you can add "Sina Weibo"/MSN Oh, starrycheng@live.com, we all discuss together, study together.

Finally, let's add one point for the whole space system.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.