kcd-clan Posted April 19, 2006 Share Posted April 19, 2006 (edited) Its really basic took me like 5 min to do cause im working on making a game for auto it and this is apart of the script. well sorda its the same way it works in a lil bit im adding another one like it expandcollapse popupDim $x,$y,$moveDOWN,$moveLEFT,$moveRIGHT,$moveUP $x=250 $y=250 HotKeySet("{ESC}","STOP") main() Func load($percent) If $percent = 0 Then ProgressOn("Loading", "This may take a little while", "0 percent") EndIf ProgressSet( $percent, $percent & " percent") If $percent = 100 Then ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() EndIf EndFunc Func main() load(0) $dir=@ScriptDir&"\" $config=$dir&"" $keys=$config&"main.ini" $data=$dir&"data\" $moveUP=IniRead($keys,"KEYS","moveUP","0") If $moveUP = 0 Then IniWrite($keys,"KEYS","moveUP","UP") EndIf load(25) $moveDOWN=IniRead($keys,"KEYS","moveDOWN","0") If $moveDOWN = 0 Then IniWrite($keys,"KEYS","moveDOWN","DOWN") EndIf load(50) $moveLEFT=IniRead($keys,"KEYS","moveLEFT","0") If $moveLEFT = 0 Then IniWrite($keys,"KEYS","moveLEFT","LEFT") EndIf load(75) $moveRIGHT=IniRead($keys,"KEYS","moveRIGHT","0") If $moveRIGHT = 0 Then IniWrite($keys,"KEYS","moveRIGHT","RIGHT") EndIf HotKeySet("{"&$moveUP&"}","moveUP") HotKeySet("{"&$moveDOWN&"}","moveDOWN") HotKeySet("{"&$moveLEFT&"}","moveLEFT") HotKeySet("{"&$moveRIGHT&"}","moveRIGHT") load(100) ToolTip("",$x,$y) While 1 WEnd EndFunc Func STOP() ;$msg = $GUI_EVENT_CLOSE Exit EndFunc Func moveUP() $y=$y-10 ToolTip("\/",$x,$y) EndFunc Func moveDOWN() $y=$y+10 ToolTip("/\",$x,$y) EndFunc Func moveLEFT() $x=$x-10 ToolTip(">",$x,$y) EndFunc Func moveRIGHT() $x=$x+10 ToolTip("<",$x,$y) EndFunc Edited April 19, 2006 by kcd-clan Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone() Link to comment Share on other sites More sharing options...
kcd-clan Posted April 19, 2006 Author Share Posted April 19, 2006 heres a cat and mouse one. it chases your mouse its will be messy but its just basic not any up left or down right movments direct up down left right expandcollapse popupDim $x,$y,$moveDOWN,$moveLEFT,$moveRIGHT,$moveUP $x=250 $y=250 $speed=15 HotKeySet("{ESC}","STOP") Func STOP() ;$msg = $GUI_EVENT_CLOSE Exit EndFunc Func moveUP() $y=$y-$speed ToolTip("\/",$x,$y) EndFunc Func moveDOWN() $y=$y+$speed ToolTip("/\",$x,$y) EndFunc Func moveLEFT() $x=$x-$speed ToolTip(">",$x,$y) EndFunc Func moveRIGHT() $x=$x+$speed ToolTip("<",$x,$y) EndFunc While 1 $pos=MouseGetPos() ;~ ToolTip("\/ x -"&$pos[0]&"y -"&$pos[1],$x,$y) If $x < $pos[0] Then moveRIGHT() Sleep(10) EndIf If $x > $pos[0] Then moveLEFT() Sleep(10) EndIf If $y < $pos[1] Then moveDOWN() Sleep(10) EndIf If $y > $pos[1] Then moveUP() Sleep(10) EndIf WEnd Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone() Link to comment Share on other sites More sharing options...
slightly_abnormal Posted April 20, 2006 Share Posted April 20, 2006 cool. Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2006 Share Posted April 20, 2006 Funny... I like it... 8) Link to comment Share on other sites More sharing options...
Markus Posted April 20, 2006 Share Posted April 20, 2006 coooooool!!!!! i liked ur game so much that i upgraded it to snake^^ expandcollapse popup#include <GUIConstants.au3> HotKeySet("{UP}","moveUP") HotKeySet("{DOWN}","moveDOWN") HotKeySet("{LEFT}","moveLEFT") HotKeySet("{RIGHT}","moveRIGHT") HotKeySet("{ESC}","_exit") Global $direction="right" Global $x=100 Global $y=100 Global $x_apfel=50 Global $y_apfel=50 Global $apfel=0 Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc $gui=GUICreate("",20,20,50,50,$WS_POPUP) GUICtrlCreatePic(@ScriptDir & "\Apfel.bmp",0,0,20,20) $a = DLLCall(@ScriptDir & "\BMP2RGN.dll","int","BMP2RGN", "str",@ScriptDir & "\Apfel.bmp", "int",255,"int",255,"int",255 ) SetWindowRgn($gui, $a[0]) GUISetState(@sw_show) Func moveUP() $direction="up" EndFunc Func moveDOWN() $direction="down" EndFunc Func moveLEFT() $direction="left" EndFunc Func moveRIGHT() $direction="right" EndFunc Func _exit() MsgBox(0,"Gameover",$apfel & " geschafft!") Exit EndFunc While 1 If $direction="right" Then $x=$x+10 ToolTip(">",$x,$y) Sleep(20) EndIf If $direction="left" Then $x=$x-10 ToolTip("<",$x,$y) Sleep(20) EndIf If $direction="up" Then $y=$y-10 ToolTip("/\",$x,$y) Sleep(20) EndIf If $direction="down" Then $y=$y+10 ToolTip("\/",$x,$y) Sleep(20) EndIf If $x>=$x_apfel-10 And $x<=$x_apfel+10 And $y>=$y_apfel-10 And $y<=$y_apfel+10 Then $x_vor=Random ( 0 ,(@DesktopWidth-20)/10 , 1 ) $x_apfel=$x_vor*10 $y_vor=Random ( 0 ,(@DesktopHeight-20)/10 , 1 ) $y_apfel=$y_vor*10 WinMove($gui,"",$x_apfel,$y_apfel) $apfel=$apfel+1 EndIf If $x>@DesktopWidth Or $x<0 Or $y<0 Or $y>@DesktopHeight Then MsgBox(0,"Gameover",$apfel & " geschafft!") Exit EndIf WEnd Attachments and source in one folder Apfel.bmpBMP2RGN.dll "It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output Link to comment Share on other sites More sharing options...
blindwig Posted May 1, 2006 Share Posted May 1, 2006 Inspired by this thread, I wrote my own snake:http://www.autoitscript.com/forum/index.php?showtopic=25481Thanks! My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
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