AutoHotkey Community

It is currently May 27th, 2012, 10:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: My Aquarium
PostPosted: June 15th, 2008, 10:21 pm 
Rajat wrote:
Not a utility. Not useful. Just something i did while getting bored.

A little box with a fish swimming here n there in random paths.
To try just put both of these files in script's folder and run.

http://drop.io/myfishy

Maybe someday someone will write a game in ahk... ;)


Code:
; Generated by SmartGUI Creator 3.2

Gui, color, 0xA2C6EC

Gui, Add, Picture, +BackgroundTrans AltSubmit x333 y166 w32 h32, %a_scriptdir%\fish.ico
Gui, Add, Picture, +BackgroundTrans AltSubmit x-50 y-50 w32 h32, %a_scriptdir%\fish2.ico

Gui, Show, x158 y110 h350 w450, Rajat's Aquarium
Goto, MoveFish

GuiClose:
ExitApp


MoveFish:
   CurrFish = Static1
   OtherFish = Static2
   
   Loop
   {
      Random, UpDn, 1, 2
      Random, DistUpDn, 5, 10

      Loop, %DistUpDn%
      {
         ControlGetPos, F1X, F1Y,,, %CurrFish%, Rajat's Aquarium

         IfEqual, UpDn, 1
            IfGreater, F1Y, 40
               F1Y -= 2

         IfEqual, UpDn, 2
            IfLess, F1Y, 340
               F1Y += 2

         IfEqual, GoRight, 1
            F1X += 2
         Else
            F1X -= 2

         ControlMove, %CurrFish%, %F1X%, %F1Y%,,, Rajat's Aquarium
         sleep, 30
         Gosub, CheckPos
      }
   }
Return


CheckPos:
   ControlGetPos, F1X, F1Y,,, %CurrFish%, Rajat's Aquarium
   WinGetPos, WinX, WinY, WinW, WinH, Rajat's Aquarium
   
   IfLess, F1X, 0
   {
      Control, Hide,, %CurrFish%, Rajat's Aquarium
      ControlMove, %OtherFish%, %F1X%, %F1Y%,,, Rajat's Aquarium
      Control, Show,, %OtherFish%, Rajat's Aquarium
      
      TempStor = %CurrFish%
      CurrFish = %OtherFish%
      OtherFish = %TempStor%
      GoRight = 1
   }
   
   IfGreater, F1X, %WinW%
   {
      Control, Hide,, %CurrFish%, Rajat's Aquarium
      ControlMove, %OtherFish%, %F1X%, %F1Y%,,, Rajat's Aquarium
      Control, Show,, %OtherFish%, Rajat's Aquarium
      
      TempStor = %CurrFish%
      CurrFish = %OtherFish%
      OtherFish = %TempStor%
      GoRight = 0
   }
Return

You need to login! :x


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group