Andreik Posted July 25, 2008 Posted July 25, 2008 I write a simple game. You must recognize famous people. If somebody don't appear in list and is worthy to be there please add.expandcollapse popup#include <GDIPlus.au3> #include <File.au3> #include <String.au3> HotKeySet("{ESC}","Quit") Global $TURN = 0 Global $CORRECT = 0 Global $CLEAR = _StringRepeat(" ",50) Global $MAX = _FileCountLines(@ScriptDir & "\People.txt") Global $NAME[5] Global $EXIST_IMAGE = 0 $NAME[0] = 4 Global $PEOPLE[$MAX+1] $PEOPLE[0] = $MAX Global $BUTTON[5] $BUTTON[0] = 4 Global $LABEL[5] $LABEL[0] = 4 ;~ Load People Names $FILE = FileOpen(@ScriptDir & "\People.txt",0) For $INDEX = 1 To $MAX $PEOPLE[$INDEX] = FileReadLine($FILE,$INDEX) Next FileClose($FILE) $GUI = GUICreate("Famous People of History",1024,768,0,0,0x80000000) $BUTTON[1] = GUICtrlCreateButton("",10,628,200,50) $BUTTON[2] = GUICtrlCreateButton("",10,688,200,50) $BUTTON[3] = GUICtrlCreateButton("",814,628,200,50) $BUTTON[4] = GUICtrlCreateButton("",814,688,200,50) $LABEL[1] = GUICtrlCreateLabel("",10,200,200,100,0x01) $LABEL[2] = GUICtrlCreateLabel("",10,350,200,100,0x01) $LABEL[3] = GUICtrlCreateLabel("",814,200,200,100,0x01) $LABEL[4] = GUICtrlCreateLabel("",814,350,200,100,0x01) GUISetState(@SW_SHOW,$GUI) _GDIPlus_Startup() $GRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) While 1 $TURN = $TURN + 1 $CHOOSE = GetNames() $SELECT = Random(1,4,1) $IMG = @ScriptDir & "\Pic\" & $CHOOSE[$SELECT] & ".JPG" $GDI_IMG = _GDIPlus_ImageLoadFromFile($IMG) $WIDTH = _GDIPlus_ImageGetWidth($GDI_IMG) $HEIGHT = _GDIPlus_ImageGetHeight($GDI_IMG) _GDIPlus_GraphicsDrawImage($GRAPHIC,$GDI_IMG,512-$WIDTH/2,384-$HEIGHT/2) For $I = 1 To $BUTTON[0] GUICtrlSetData($BUTTON[$I],$CHOOSE[$I]) Next While 1 $MSG = GUIGetMsg() Select Case $MSG = $BUTTON[1] If $SELECT = 1 Then $CORRECT += 1 GUICtrlSetData($LABEL[1],"Your answer: " & $CHOOSE[1]) GUICtrlSetData($LABEL[2],"Correct answer: " & $CHOOSE[$SELECT]) Sleep(1500) GUICtrlSetData($LABEL[1],$CLEAR) GUICtrlSetData($LABEL[2],$CLEAR) ExitLoop Case $MSG = $BUTTON[2] If $SELECT = 2 Then $CORRECT += 1 GUICtrlSetData($LABEL[1],"Your answer: " & $CHOOSE[2]) GUICtrlSetData($LABEL[2],"Correct answer: " & $CHOOSE[$SELECT]) Sleep(1500) GUICtrlSetData($LABEL[1],$CLEAR) GUICtrlSetData($LABEL[2],$CLEAR) ExitLoop Case $MSG = $BUTTON[3] If $SELECT = 3 Then $CORRECT += 1 GUICtrlSetData($LABEL[1],"Your answer: " & $CHOOSE[3]) GUICtrlSetData($LABEL[2],"Correct answer: " & $CHOOSE[$SELECT]) Sleep(1500) GUICtrlSetData($LABEL[1],$CLEAR) GUICtrlSetData($LABEL[2],$CLEAR) ExitLoop Case $MSG = $BUTTON[4] If $SELECT = 4 Then $CORRECT += 1 GUICtrlSetData($LABEL[1],"Your answer: " & $CHOOSE[4]) GUICtrlSetData($LABEL[2],"Correct answer: " & $CHOOSE[$SELECT]) Sleep(1500) GUICtrlSetData($LABEL[1],$CLEAR) GUICtrlSetData($LABEL[2],$CLEAR) ExitLoop EndSelect WEnd _GDIPlus_GraphicsClear($GRAPHIC,0xFFECE9D8) GUICtrlSetData($LABEL[3],$TURN & "/30") GUICtrlSetData($LABEL[4],$CORRECT & "/30") If $TURN = 30 Then SplashTextOn("SCORE","Your score is " & $CORRECT & "/30",400,25,-1,-1,1) Sleep(5000) SplashOff() _GDIPlus_Shutdown() Exit EndIf Sleep(15) WEnd Func GetNames() $NAME[1] = $PEOPLE[Random(1,Int($MAX/4),1)] $NAME[2] = $PEOPLE[Random(Int($MAX/4)+1,Int($MAX/4)*2,1)] $NAME[3] = $PEOPLE[Random(Int($MAX/4)*2+1,Int($MAX/4)*3,1)] $NAME[4] = $PEOPLE[Random(Int($MAX/4)*3+1,$MAX,1)] Return $NAME EndFunc Func Quit() _GDIPlus_Shutdown() Exit EndFuncAnd from here images : http://rapidshare.com/files/132443448/Famous_People.rar.html
DexterMorgan Posted July 25, 2008 Posted July 25, 2008 (edited) I got 10 out of 30 ! lolThis is really good It would be nice for a history teacher...I made another link.. direct ... No Wait http://pointless.spruz.com/user/180543/new...zip_archive.zip Edited July 26, 2008 by Konstig code
TehWhale Posted July 25, 2008 Posted July 25, 2008 Ahh for heaven sakes, please stop using rapidshare everyone! Sendspace.com is 100% free, no waiting, just click 1 link, no capatachas! Cool game, ah I know a famous person who should be added! Me!
DexterMorgan Posted July 26, 2008 Posted July 26, 2008 LOL... You ... Famous..... HA!... If anyone should be added it should be.... ME! :Mysterious Face: code
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