sin(x)

From ENIGMA
Jump to navigation Jump to search

Description

Gets the mathematical sine of x, where x is in radians. To get the sine of x in degrees, use sind.

Parameters

Parameter Data Type Description
x double the angle, in radians

Return Values

double: Returns the mathematical sine of x.

Example Call

// Simulate a Super Mario World finish line, only easier to hit
// Move the finish line up and down in a sine pattern to give time to hit it at the peaks and troughs
double height_2 = obj_finishpoles.height / 2; // We need an amplitude of the height of the finish line, so we'll use half the height as the multiplier
obj_finishline.y = obj_finishpoles.y - height_2 + height_2 * sin(phase); // Set the y-coordinate to the sine of our phase * multiplier
phase += pi / 3 / room_speed; // Add to the phase so it reaches a full cycle (2π radians) in 3 seconds