FaridAgl Posted December 8, 2011 Posted December 8, 2011 I hope you like it.expandcollapse popup#NoTrayIcon #AutoIt3Wrapper_Icon=Resources\Icon.ico #AutoIt3Wrapper_Outfile=Frog Maze.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=This software is freeware and may be used and/or distributed freely under the assumption the contents of the archive are not changed or altered in any way and it's contents are intact. #AutoIt3Wrapper_Res_Description=Developer : D4RK.ON3 | aghili_farid@yahoo.com #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_LegalCopyright=© 2010-2011 D4RK.ON3. All Rights Reserved. #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_Tidy_Stop_OnError=n #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/SF=1 /SV=1 /CV=1 /CF=1 /CS=1 /CN=1 /OM #include <Misc.au3> Opt("GUICloseOnESC", 0) Opt("PixelCoordMode", 2) FileInstall("Resources\Fly.jpg", @TempDir & "\Fly.jpg", 1) FileInstall("Resources\Maze.bmp", @TempDir & "\Maze.bmp", 1) FileInstall("Resources\Frog.jpg", @TempDir & "\Frog.jpg", 1) Const $Title = "Frog Maze" _Singleton($Title) Global $BestScore = 99999, $First = 1 $GUI = GUICreate($Title, 640, 480) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Coordinate", 530, 400, 100, 70) GUICtrlCreateLabel("X Pos:", 540, 420, 35, 17) GUICtrlCreateLabel("Y Pos:", 540, 445, 35, 17) $X = GUICtrlCreateLabel(122, 580, 420, 35, 17) $Y = GUICtrlCreateLabel(37, 580, 445, 35, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Game Field", 10, 10, 620, 380) GUICtrlCreatePic(@TempDir & "\Maze.bmp", 113, 35, 443, 331) $Fly = GUICtrlCreatePic(@TempDir & "\Fly.jpg", 538, 366, 19, 20) $Frog = GUICtrlCreatePic(@TempDir & "\Frog.jpg", 122, 37, 5, 5) GUICtrlSetBkColor($Frog, 0xFF0000) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Help", 10, 400, 315, 70) GUICtrlCreateLabel("Use the Arrow keys to reach the Fly through the Maze.", 20, 420, 276, 17) GUICtrlCreateLabel("Press Enter to restart the Game.", 20, 445, 154, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("State", 335, 400, 185, 70) GUICtrlCreateLabel("Time Spent:", 345, 420, 61, 17) $Timer = GUICtrlCreateLabel(0, 410, 420, 16, 17, 0x1) GUICtrlCreateLabel("second(s).", 435, 420, 53, 17) GUICtrlCreateLabel("Best Score:", 345, 445, 59, 17) $Score = GUICtrlCreateLabel("?", 410, 445, 16, 17, 0x1) GUICtrlCreateLabel("second(s).", 435, 445, 53, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() ;~ ---------------------------------------------------------------------------------------------------- While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch Select Case _IsPressed(25) If $First = 1 Then _FirstMove() Else _Move("Left") EndIf Case _IsPressed(26) If $First = 1 Then _FirstMove() Else _Move("Up") EndIf Case _IsPressed(27) If $First = 1 Then _FirstMove() Else _Move("Right") EndIf Case _IsPressed(28) If $First = 1 Then _FirstMove() Else _Move("Down") EndIf Case _IsPressed("0D") If WinActive($Title, "Game Field") Then _Restart() EndSelect WEnd ;~ ---------------------------------------------------------------------------------------------------- Func _Move($Key) If WinActive($Title, "Game Field") Then Switch $Key Case "Left" If _Left() Then GUICtrlSetPos($Frog, GUICtrlRead($X) - 2, GUICtrlRead($Y)) GUICtrlSetData($X, GUICtrlRead($X) - 2) EndIf Case "Up" If _Up() Then GUICtrlSetPos($Frog, GUICtrlRead($X), GUICtrlRead($Y) - 2) GUICtrlSetData($Y, GUICtrlRead($Y) - 2) EndIf Case "Right" If _Right() Then GUICtrlSetPos($Frog, GUICtrlRead($X) + 2, GUICtrlRead($Y)) GUICtrlSetData($X, GUICtrlRead($X) + 2) EndIf Case "Down" If _Down() Then GUICtrlSetPos($Frog, GUICtrlRead($X), GUICtrlRead($Y) + 2) GUICtrlSetData($Y, GUICtrlRead($Y) + 2) EndIf EndSwitch _Check() EndIf EndFunc ;==>_Move Func _FirstMove() $First = 0 AdlibRegister("_Timer", 1000) EndFunc ;==>_FirstMove Func _Left() $FrogPos = ControlGetPos($Title, "Game Field", "[CLASS:Static; INSTANCE:7]") If Hex(PixelGetColor($FrogPos[0] - 1, $FrogPos[1] + 2, $GUI), 6) = 010080 Then Return 0 Else Return 1 EndIf EndFunc ;==>_Left Func _Up() $FrogPos = ControlGetPos($Title, "Game Field", "[CLASS:Static; INSTANCE:7]") If Hex(PixelGetColor($FrogPos[0] + 2, $FrogPos[1] - 1, $GUI), 6) = 010080 Then Return 0 Else Return 1 EndIf EndFunc ;==>_Up Func _Right() $FrogPos = ControlGetPos($Title, "Game Field", "[CLASS:Static; INSTANCE:7]") If Hex(PixelGetColor($FrogPos[0] + 5, $FrogPos[1] + 2, $GUI), 6) = 010080 Then Return 0 Else Return 1 EndIf EndFunc ;==>_Right Func _Down() $FrogPos = ControlGetPos($Title, "Game Field", "[CLASS:Static; INSTANCE:7]") If Hex(PixelGetColor($FrogPos[0] + 2, $FrogPos[1] + 5, $GUI), 6) = 010080 Then Return 0 Else Return 1 EndIf EndFunc ;==>_Down Func _Check() $FrogPos = ControlGetPos($Title, "Game Field", "[CLASS:Static; INSTANCE:7]") If Number($FrogPos[0]) >= 542 And Number($FrogPos[0]) <= 547 Then If Number($FrogPos[1]) >= 366 And Number($FrogPos[1]) <= 370 Then If Number(GUICtrlRead($Timer)) < Number($BestScore) Then $BestScore = GUICtrlRead($Timer) GUICtrlSetData($Score, GUICtrlRead($Timer)) EndIf MsgBox(64, $Title, "Congratulations! You have won the Fly!" & @CRLF & "Your best score is " & $BestScore & " Second(s)" & @CRLF & "Click OK to restart the Game.", 0, $GUI) _Restart() EndIf EndIf EndFunc ;==>_Check Func _Timer() GUICtrlSetData($Timer, GUICtrlRead($Timer) + 1) EndFunc ;==>_Timer Func _Restart() $First = 1 AdlibUnRegister("_Timer") GUICtrlSetData($X, 122) GUICtrlSetData($Y, 37) GUICtrlSetPos($Frog, 122, 37) GUICtrlSetData($Timer, 0) EndFunc ;==>_RestartZip Package:http://www.mediafire.com/?df9t0fb9s6peq63Compiled:http://www.mediafire.com/?j38q9qqzwluc6c6 http://faridaghili.ir
JScript Posted December 8, 2011 Posted December 8, 2011 (edited) Perfect! Very good indeed, thanks for sharing.Best regards,Edit: But the beetle is not flying... What could be, I use Windows 7 32bit.Wow, now I understand how it works! I'm sorry.João Carlos. Edited December 8, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!
FaridAgl Posted December 8, 2011 Author Posted December 8, 2011 That should not fly, you start the game from on side and should reach to other side to exit the Maze. http://faridaghili.ir
FaridAgl Posted December 8, 2011 Author Posted December 8, 2011 Another one, it's most simple and easy to win!Zip Package:http://www.mediafire.com/?9j02ahyqpm533j1Compiled File:http://www.mediafire.com/?n68uekum5iub719 http://faridaghili.ir
JScript Posted December 8, 2011 Posted December 8, 2011 (edited) That should not fly, you start the game from on side and should reach to other side to exit the Maze.The beetle goes nowhere, it is still!Wow, now I understand how it works! I'm sorry.João Carlos. Edited December 8, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!
FaridAgl Posted December 8, 2011 Author Posted December 8, 2011 No problem dude. Hope you like it and the find the source useful. http://faridaghili.ir
BigDod Posted December 8, 2011 Posted December 8, 2011 112 seconds for the difficult one Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now