M4nu
Member
Greetings to the GMC!
I'm looking into spinning a wheel of fortune with the space bar. I got the constant rotating speed using image_angle and a smooth but rather sudden slowdown of the rotation. As I'm a rookie with the coding, I'm looking for advise on what to do here to have a more realistic rotation. How would I use friction or physics to get a realistic rotation movement and slowdown of speed? Basically I want it to have a more delayed slowdown than what it is now. Otherwise it would be cool if the speed increases the longer you hold down space bar and when you release it, the slowdown is relative to the speed of rotation. I would be appreciative of both coding advise for beginners and of advise on drag n drop functions.
Here is the code that I used:
//CREATE EVENT
rspeed = 20; //the speed of rotation, how fast it rotates
Point_dir = 0; //the variable that will store what direction to rotate to
Is_Rotating = 0; //is it rotating, used in the STEP event to rotate the object
//KEYBOARD SPACE EVENT
Point_dir = image_angle + 45; //the angle to rotate to, add 45 degrees to current angle
Is_Rotating = 1; //set to true
//STEP EVENT
if (Is_Rotating == 1) //if its set to rotate the object
{
image_angle += sin(degtorad(Point_dir - image_angle))*rspeed;
}
I'm looking into spinning a wheel of fortune with the space bar. I got the constant rotating speed using image_angle and a smooth but rather sudden slowdown of the rotation. As I'm a rookie with the coding, I'm looking for advise on what to do here to have a more realistic rotation. How would I use friction or physics to get a realistic rotation movement and slowdown of speed? Basically I want it to have a more delayed slowdown than what it is now. Otherwise it would be cool if the speed increases the longer you hold down space bar and when you release it, the slowdown is relative to the speed of rotation. I would be appreciative of both coding advise for beginners and of advise on drag n drop functions.
Here is the code that I used:
//CREATE EVENT
rspeed = 20; //the speed of rotation, how fast it rotates
Point_dir = 0; //the variable that will store what direction to rotate to
Is_Rotating = 0; //is it rotating, used in the STEP event to rotate the object
//KEYBOARD SPACE EVENT
Point_dir = image_angle + 45; //the angle to rotate to, add 45 degrees to current angle
Is_Rotating = 1; //set to true
//STEP EVENT
if (Is_Rotating == 1) //if its set to rotate the object
{
image_angle += sin(degtorad(Point_dir - image_angle))*rspeed;
}