Jump to content

Mouse-Go-Round!


the DtTvB
 Share

Recommended Posts

Hope you like it. The commentating is the hardest part for me. It may be buggy if you move your mouse too fast.

You can move your mouse clockwise and counter clockwise.

; Some greeting tooltips!
toolTip ('Get ready to move your mouse round the screen.', 20, 20, 'Mouse-Go-Round!', 1);
sleep (2000);
toolTip ('Three!', 20, 20, 'Mouse-Go-Round!', 1);
sleep (1000);
toolTip ('Two!', 20, 20, 'Mouse-Go-Round!', 1);
sleep (1000);
toolTip ('One and...', 20, 20, 'Mouse-Go-Round!', 1);
sleep (1000);
toolTip ('GO!', 20, 20, 'Mouse-Go-Round!', 1);

; The pie, mutiplied by 2.
global $twopi = 3.141592653589793 * 2;

; Get the hypotenuse from another 2 sides of the right-angled triangle.
func getHypotenuse($x, $y)
    return sqrt(($x ^ 2) + ($y ^ 2));
endFunc;

; Get the angle from $x and $y.
func getAngle($x, $y)
    $dist  = getHypotenuse($x, $y);
    if ($dist <= 0) then;
        return 0;
    endIf;
    $angle = round((aSin($x / $dist) / $twopi) * 360);
    if ($y > 0) then;
        $angle = 180 - $angle;
    endIf;
    if ($angle < 0) then;
        $angle += 360;
    endIf;
    return $angle;
endFunc;

; Get the angle from the mouse, relative to the centre of the screen.
func getAngleFromMouse()
    $pos     = mouseGetPos();
    $pos[0] -= @DesktopWidth  / 2;
    $pos[1] -= @DesktopHeight / 2;
    return getAngle($pos[0], $pos[1]);
endFunc;

; Initialize the function.
$oldAngle = getAngleFromMouse();
$sumAngle = 0;
$calAngle = 0;
; Loop for 10 seconds (400 * 25).
for $i = 0 to 400;
    ; Get the new angle and compare with the old one.
    $newAngle = getAngleFromMouse();
    $difAngle = ($newAngle - $oldAngle);

    ; A lot of difference! It should be no more than 180 degrees.
    if ($difAngle > 180) then;
        $difAngle = 360 - $difAngle;
    endIf;
    if ($difAngle < -180) then;
        $difAngle = -360 - $difAngle;
    endIf;

    ; Add it to the sum, and calculate the number of rounds.
    $sumAngle += $difAngle;
    $calAngle  = round(abs($sumAngle / 180), 3);

    ; Display the tooltip after 1 second.
    if ($i > 40) then
        $s = 's';
        if ($calAngle == 1) then;
            $s = '';
        endIf;
        $sc = round((400 - $i) / 40, 2);
        $s2 = 's';
        if ($sc == 1) then;
            $s2 = '';
        endIf;
        toolTip ('You moved your mouse ' & $calAngle & ' time' & $s & ' round the screen!' & @CrLf & 'You have ' & $sc & ' second' & $s2 & ' left!', 20, 20, 'Mouse-Go-Round!', 1);
    endIf;

    ; Change the old angle.
    $oldAngle = getAngleFromMouse();

    ; Sleep.
    sleep (25);
next;

; Game over.
toolTip ('Game over! You moved your mouse ' & $calAngle & ' time' & $s & '!', 20, 20, 'Mouse-Go-Round!', 1);
sleep (2000);
Link to comment
Share on other sites

61.625 :P Good game

edit: 69 times

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...