sin - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
Gets the mathematical sine of x, where x is in radians. To get the sine of x in degrees, use <code=EDL>sind(x)
- x: The angle whose sine is to be returned, in radians.
Returns the mathematical sine of x.
// 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
NOTOC
Category:Function:Real