Jump to content

fishie - The game ;)


ludocus
 Share

Recommended Posts

I had nothing to do and I made this:

#include <GUIConstants.au3>
;RegDelete ("HKEY_LOCAL_MACHINE\SOFTWARE\fishie","score" )
;exit
$reger = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\fishie","score" )
$oSp = ObjCreate("SAPI.SpVoice")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("collect worms", 335, 235, 193, 125)
$add = GUICtrlCreateButton("add a worm", 16, 48, 75, 25, 0)
$take = GUICtrlCreateButton("take a worm", 16, 96, 75, 25, 0)
$worms = GUICtrlCreateLabel("Worms in can: 0", 168, 100, 100, 17)
$fish = GUICtrlCreateButton("Go Fishing", 120, 176, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$dat = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         
     Case $add
         $dat = $dat + 1
         GUICtrlSetData ( $worms, 'Worms in can: '&$dat )
         
     Case $take
         $dat = $dat - 1
         GUICtrlSetData ( $worms, 'Worms in can: '&$dat )
         
     Case $fish
         goFish()        
         exitloop
    EndSwitch
WEnd

func goFish()
GUIDelete ( $Form1 )
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("fishing", 452, 320, 193, 125)
$fish = GUICtrlCreateButton("Fish", 160, 72, 75, 25, 0)
$fishes = GUICtrlCreateLabel("Fish: 0", 128, 160, 278, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$worm = GUICtrlCreateLabel("Worms: "&$dat, 128, 200, 278, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$stop = GUICtrlCreateButton("Stop", 168, 272, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$f = 0
$hop = 1
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            msgbox ( 0, "Goodbye", "Goodbye Thnx for playing this game!" )
            $oSp.Speak("Goodbye Thanks for playing this game "&$f )
            exit
            
        Case $fish
            $reg = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\fishie","score" )
            if $dat = 0 or $dat < 0 Then
                $oSp.Speak('worms up ' )
                sleep ( 200 )
                $oSp.Speak('Game over')
                $oSp.Speak(' Fish cought: '&$f )
                msgbox ( 0, "Aww...", "worms up.. Game over.."&@CRLF&"Fish cought: "&$f )
                
                Exit
            EndIf
            if $reg > $reger and $hop = 1 then
            msgbox ( 0, "YAY!", "Hoeray! Highscore reached" )
            $hop = $hop + 1
            EndIf
            $r = random ( 1, 2, 1 )
            ;GUICtrlSetData ( $fishes, 'Trying to catch a fish' )
            $oSp.Speak('Trying to catch a fish..')
            ;sleep ( 4000 )
            if $r = 2 Then
                $f = $f + 1
                $dat = $dat - 1
                GUICtrlSetData ( $fishes, 'Fish: '&$f )
                GUICtrlSetData ( $worm, 'Worms: '&$dat )
                RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\fishie","score", "REG_SZ", $f&"" )
            Else
                $dat = $dat - 1
                $oSp.Speak("didn't catch a fish" )
                ;GUICtrlSetData ( $fishes, "Aww.. didn't catch a fish" )
                GUICtrlSetData ( $worm, 'Worms: '&$dat )
                ;sleep ( 2000 )
                GUICtrlSetData ( $fishes, 'Fish: '&$f )
                ;RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\fishie","score", "REG_SZ", $f&"" )
            EndIf
            
        Case $stop
            msgbox ( 0, "Goodbye", "Goodbye Thnx for playing this game!" )
            $oSp.Speak("Goodbye Thanks for playing this game " )
            exit

    EndSwitch
WEnd

EndFunc

Enjoy!

Edited by ludocus
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...