Trigonometry And Class Diagrams

Today with Ant we learned how Trigonometry can be implemented into a game. When making a 2D game, Trigonometry can be used to move and rotate the player. This is because the X axis is divided by the Y axis or the other way around.

To get the Sine you need to divide the Opposite by the Hypotenuse, to get the Cosine you need to divide the Adjacent by the Hypotenuse and to get the Tangent you need to divide the Opposite by the Adjacent. The Opposite is always the Y axis.

There are also Radians, which are alternative to degrees and can be used with Pi. One Pi Radian is 180 degrees, two Radians is 360 degrees or a full circle.

Classes are a recipe or blueprint of your code and include the stats of whatever you are coding, in a simple format.

Step one includes the name, age etc, step two included stats and variables with the name of the property, for example float or vector. The last step presents the type of data returned by the functions can follow in brackets. It also lists the actions and functions with parameters and data types.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s