Alek Posted March 14, 2008 Share Posted March 14, 2008 (edited) here is a small memory game i made ^^, Just click the correct button Edit: More buttons Edit: Added Timer, if its enabled the you have 3sec to click on the next button timer doesn't start until you press the first button. expandcollapse popup#include <GUIConstants.au3> Global $Button[10] Global $Color_Low[10] = [0,0xaa0000,0x00aa00,0x0000aa,0xaaaa00,0xaa00aa,0x00aaaa,0xaa8800,0x6F3198,0xcccccc] Global $Color_High[10] = [0,0xff0000,0x00ff00,0x0000ff,0xffff00,0xff00ff,0x00ffff,0xFFbb00,0xA163CA,0xffffff] Global $Cur_Button Global $Cur_Sequence Global $Number Global $Click_Timer ;Setings Global $Enable_Timer = True $Form1 = GUICreate("0-0", 150, 170, -1, -1) $p = 1 GUISetState(@SW_SHOW) For $y = 0 To 100 Step 50 For $x = 0 To 100 Step 50 $Button[$p] = GUICtrlCreateButton("", $x, $y, 50, 50, 0) _Blink($Button[$p],$Color_High[$p],$Color_Low[$p],50) $p += 1 Next Next Sleep(1000) _SetColors() While 1 $nMsg = GUIGetMsg() If $nMsg = $Button[$Number[$Cur_Button]] And (TimerDiff($Click_Timer) < 3000 Or $Click_Timer = 0)Then _Blink($Button[$Number[$Cur_Button]],$Color_High[$Number[$Cur_Button]],$Color_Low[$Number[$Cur_Button]],100) $Cur_Button += 1 If $Enable_Timer Then $Click_Timer = TimerInit() ElseIf $nMsg = $GUI_EVENT_CLOSE Then Exit ElseIf $nMsg > 0 Or TimerDiff($Click_Timer) > 3000 And $Click_Timer > 0 Then WinSetTitle($Form1,'','Game Over!') For $x = 1 To 9 GUICtrlSetBkColor($Button[$x],0x000000) Sleep(10) Next Sleep(1500) For $x = 1 To 9 GUICtrlSetBkColor($Button[$x],$Color_Low[$x]) Sleep(10) Next Sleep(500) $Cur_Sequence = '' _SetColors() $Click_Timer = 0 EndIf If $Cur_Button > $Number[0] Then Sleep(1000) _SetColors() EndIf WEnd Func _SetColors() $Cur_Sequence &= Random(1,9,1) $Number = StringSplit($Cur_Sequence,'') WinSetTitle($Form1,'', 0 & '-' & $Number[0]) $Cur_Button = 1 For $x = 1 To $Number[0] _Blink($Button[$Number[$x]],$Color_High[$Number[$x]],$Color_Low[$Number[$x]],200) Sleep(10) Next $Click_Timer = 0 Return EndFunc Func _Blink($s_Ctrl,$s_Color1,$s_Color2,$s_Speed) GUICtrlSetBkColor($s_Ctrl,$s_Color1) Sleep($s_Speed) GUICtrlSetBkColor($s_Ctrl,$s_Color2) Sleep($s_Speed) Return EndFunc My Record: 19 Edited March 16, 2008 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Swift Posted March 14, 2008 Share Posted March 14, 2008 21! BEAT DAT! fun game dude! Link to comment Share on other sites More sharing options...
Valuater Posted March 14, 2008 Share Posted March 14, 2008 Really nice!!! ... and only 70 lines of code too! 8) Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted March 15, 2008 Share Posted March 15, 2008 I'm not a fan of memory games but this one is well written Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
sensalim Posted March 15, 2008 Share Posted March 15, 2008 Very nice! Link to comment Share on other sites More sharing options...
malu05 Posted March 15, 2008 Share Posted March 15, 2008 Takes one round to figure what its all about. And it is quite fun! i got to 11... [center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center] Link to comment Share on other sites More sharing options...
rasim Posted March 16, 2008 Share Posted March 16, 2008 (edited) Super! I like this! Very small code and fun game. Thank you! Edited March 16, 2008 by rasim Link to comment Share on other sites More sharing options...
Aassdd Posted March 16, 2008 Share Posted March 16, 2008 Very nice. You could also add timer Will be harder. Link to comment Share on other sites More sharing options...
Kip Posted March 16, 2008 Share Posted March 16, 2008 (edited) 11 Edited March 16, 2008 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. 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