Results 1 to 11 of 11

Thread: Gravity

  1. #1
    Join Date
    Apr 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Gravity

    Open up paint, drag the canvas out to 750x500 px. Set focus on paint and run. Drag and let go to "throw" the mouse. Kind of buggy but I don't want to fix it.

    Code:
    program MouseGravity;  //by Zup
    const
      bounce = 0.9;  //Energy lost when cursor hits wall (1 = no loss, > 1 = gain in energy)
      drag = 0.8;    //Overall drag on the cursor
      g = 1;         //Mouse gravity
      xvStart = 15;  //Initial x-velocity
      throwSensitivity = 20;  //Higher will move cursor with slower mouse movements
      waitTime = 10;          //Do not change unless your computer is slow (then make lower)
    
    function p(num: Extended): Extended;
    begin
      if(num < 0)then
        result:= num * -1;
    end;
    
    function n(num: Extended): Extended;
    begin
      if(num > 0)then
        result:= num * -1;
    end;
    
    procedure Gravity;
    var
      x, y, oldx, oldy, newx, newy: Integer;
      xe, ye, xv, yv: Extended;
    begin
      xv:= xvStart;
      yv:= 0;
      repeat
        GetMousePos(x, y);
        xe:= x;
        ye:= y;
        if(not(IsMouseButtonDown(true)))then
        begin
          if(x < 0)then
          begin
            MoveMouse(0, y);
            xv:= p(xv);
            xv:= xv * bounce;
          end;
          if(x > 750)then
          begin
            MoveMouse(750, y);
            xv:= n(xv);
            xv:= xv * bounce;
            xv:= xv * drag;
          end;
          if(y < 0)then
          begin
            MoveMouse(x, 0);
            yv:= p(yv);
            yv:= yv * bounce;
          end;
          if(y > 500)then
          begin
            MoveMouse(x, 500);
            yv:= n(yv);
            yv:= yv * bounce;
          end;
          yv:= yv + g;
          xe:= xe + xv;
          ye:= ye + yv;
          x:= Round(xe);
          y:= Round(ye);
          MoveMouse(x, y);
          wait(waitTime);
        end else
        begin
          GetMousePos(oldx, oldy);
          wait(throwSensitivity);
          GetMousePos(newx, newy);
          xv:= newx - oldx;
          yv:= newy - oldy;
        end;
      until(false);
    end;
    
    begin
      Gravity;
    end.

  2. #2
    Join Date
    Feb 2006
    Posts
    582
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hah, that's neat
    Free File Hosting
    No download timers!

    Rifkwtf.com

  3. #3
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    485
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Funny lol bouncy

  4. #4
    Join Date
    Mar 2006
    Posts
    141
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    wow this has got to be one of the coolest scripts ive seen

  5. #5
    Join Date
    Feb 2006
    Posts
    1,022
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Set bounce on 2 and hold up the runtime error shield!

  6. #6
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Haha, pretty funny

    Creds to DannyRS for this wonderful sig!

  7. #7
    Join Date
    Feb 2006
    Location
    California-Foster City
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ah it has returned

    Try setting it to -1
    The Welcoming Party
    Don't be a Fakawi! Get 25 hours of sleep a day!

  8. #8
    Join Date
    Feb 2006
    Location
    Aussie
    Posts
    937
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i seem to remeber this on kaitnieks, was it on there??wel done!

  9. #9
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I remember when you released this (Or something like this) at Kait.. Excellent ;p Keeps me occupied.

  10. #10
    Join Date
    Apr 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea it's a script I found sitting on my harddrive that I wrote when I was in Florida.

  11. #11
    Join Date
    May 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Ah shit! i droped im pincle....lol

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Gravity script
    By Zyt3x in forum OSR Help
    Replies: 11
    Last Post: 07-16-2008, 10:32 AM
  2. Gravity: Extended? Help Please.
    By Dusk412 in forum OSR Help
    Replies: 13
    Last Post: 12-23-2007, 11:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •