Juego apagar las luces
Publicado: 22 Ene 2011, 23:15
Un juego sencillo que consiste en clickar las luces verdes tan rápido como sea posible, luego te da los segundos que necesitaste.
Del foro alemán, parcialmente traducido.
Fuente y créditos:
http://www.autoit.de/index.php?page=Thr ... d3bc27b864
Salu22:)
Del foro alemán, parcialmente traducido.
Código: Seleccionar todo
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=F:\Fertige Programme\Lights out\Lights out.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include<array.au3>
#include<listviewconstants.au3>
#include<guilistview.au3>
#include<gdiplus.au3>
#include<staticconstants.au3>
local $ar[41]
global $i= random(1, 40)
global $counter=0
global $gerundet=0
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Lights out", 500, 600, 192, 124)
$knopf1 = GUICtrlCreateButton("Empezar", 23, 25, 57, 33, $WS_GROUP)
$ar[1]= GUICtrlCreateButton("", 24, 64, 57, 57, $WS_GROUP)
$ar[2]= GUICtrlCreateButton("", 82, 64, 57, 57, $WS_GROUP)
$ar[3]= GUICtrlCreateButton("", 142, 64, 57, 57, $WS_GROUP)
$ar[4]= GUICtrlCreateButton("", 203, 64, 57, 57, $WS_GROUP)
$ar[5]= GUICtrlCreateButton("", 264, 64, 57, 57, $WS_GROUP)
$ar[6]= GUICtrlCreateButton("", 24, 125, 57, 57, $WS_GROUP)
$ar[7]= GUICtrlCreateButton("", 82, 125, 57, 57, $WS_GROUP)
$ar[8]= GUICtrlCreateButton("", 142, 125, 57, 57, $WS_GROUP)
$ar[9]= GUICtrlCreateButton("", 203, 125, 57, 57, $WS_GROUP)
$ar[10]= GUICtrlCreateButton("", 264, 125, 57, 57, $WS_GROUP)
$ar[11]= GUICtrlCreateButton("", 25, 185, 57, 57, $WS_GROUP)
$ar[12]= GUICtrlCreateButton("", 83, 185, 57, 57, $WS_GROUP)
$ar[13]= GUICtrlCreateButton("", 143, 185, 57, 57, $WS_GROUP)
$ar[14]= GUICtrlCreateButton("", 204, 185, 57, 57, $WS_GROUP)
$ar[15]= GUICtrlCreateButton("", 265, 185, 57, 57, $WS_GROUP)
$ar[16]= GUICtrlCreateButton("", 25, 246, 57, 57, $WS_GROUP)
$ar[17]= GUICtrlCreateButton("", 83, 246, 57, 57, $WS_GROUP)
$ar[18]= GUICtrlCreateButton("", 143, 246, 57, 57, $WS_GROUP)
$ar[19]= GUICtrlCreateButton("", 204, 246, 57, 57, $WS_GROUP)
$ar[20]= GUICtrlCreateButton("", 265, 246, 57, 57, $WS_GROUP)
$ar[21]= GUICtrlCreateButton("", 27, 306, 57, 57, $WS_GROUP)
$ar[22]= GUICtrlCreateButton("", 85, 306, 57, 57, $WS_GROUP)
$ar[23]= GUICtrlCreateButton("", 145, 306, 57, 57, $WS_GROUP)
$ar[24]= GUICtrlCreateButton("", 206, 306, 57, 57, $WS_GROUP)
$ar[25]= GUICtrlCreateButton("", 267, 306, 57, 57, $WS_GROUP)
$ar[26]= GUICtrlCreateButton("", 27, 367, 57, 57, $WS_GROUP)
$ar[27]= GUICtrlCreateButton("", 85, 367, 57, 57, $WS_GROUP)
$ar[28]= GUICtrlCreateButton("", 145, 367, 57, 57, $WS_GROUP)
$ar[29]= GUICtrlCreateButton("", 206, 367, 57, 57, $WS_GROUP)
$ar[30]= GUICtrlCreateButton("", 267, 367, 57, 57, $WS_GROUP)
$ar[31]= GUICtrlCreateButton("", 27, 429, 57, 57, $WS_GROUP)
$ar[32]= GUICtrlCreateButton("", 85, 429, 57, 57, $WS_GROUP)
$ar[33]= GUICtrlCreateButton("", 145, 429, 57, 57, $WS_GROUP)
$ar[34]= GUICtrlCreateButton("", 206, 429, 57, 57, $WS_GROUP)
$ar[35]= GUICtrlCreateButton("", 267, 429, 57, 57, $WS_GROUP)
$ar[36]= GUICtrlCreateButton("", 27, 490, 57, 57, $WS_GROUP)
$ar[37]= GUICtrlCreateButton("", 85, 490, 57, 57, $WS_GROUP)
$ar[38]= GUICtrlCreateButton("", 145, 490, 57, 57, $WS_GROUP)
$ar[39]= GUICtrlCreateButton("", 206, 490, 57, 57, $WS_GROUP)
$ar[40]= GUICtrlCreateButton("", 267, 490, 57, 57, $WS_GROUP)
For $p= 1 to 40
guictrlsetstate($ar[$p], $gui_disable)
guictrlsetbkcolor($ar[$p], 0x000000)
next
$Button1 = GUICtrlCreateButton("Meterse en los top", 323, 25, 133, 32, $WS_GROUP)
$ListView1 = GUICtrlCreateListView("NOmbre del jugador|tiempo", 323, 65, 240, 241)
Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($ListView1)]
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 110)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 60)
guictrlsetbkcolor($listview1, 0x000000)
guictrlsetcolor($listview1, 0xFFFFFF)
$iniread= IniReadSectionNames(@Scriptdir&"\score.ini")
$armax=_ArrayMax($iniread)
For $a=1 to $armax
guictrlcreatelistviewitem($iniread[$a]&"|"& Iniread(@scriptdir&"\score.ini", $iniread[$a], "1name", ""), $listview1)
next
_GUICtrlListView_SimpleSort($listview1, $B_DESCENDING[1], 1)
soundplay(@Scriptdir&"\st.mp3",0 )
$Pic1 = GUICtrlCreatePic(@Scriptdir&"\matrix.jpg", 0, 1, 500, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
case $GUI_EVENT_CLOSE
Exit
case $knopf1
For $p= 1 to 40
guictrlsetstate($ar[$p], $gui_enable)
next
$time= Timerinit()
guictrlsetstate($knopf1, $gui_disable)
$i= random(1, 40)
guictrlsetbkcolor($ar[$i], 0x57FF5C)
case $ar[$i]
$counter+=1
If $counter=50 then
For $p= 1 to 40
guictrlsetstate($ar[$p], $gui_disable)
next
guictrlsetstate($button1, $gui_enable)
$ungerundet=Timerdiff($time)* 10^(-3)
$gerundet= StringFormat("%.2f\n", $ungerundet )
Msgbox(0, "", "Han sido "& $gerundet & "segundos para clickar todas las luces" )
$counter=0
guictrlsetbkcolor($ar[$i], 0xFFFFFF)
guictrlsetstate($knopf1, $gui_enable)
else
guictrlsetbkcolor($ar[$i], 0xFFFFFF)
$i= random(1, 40)
guictrlsetbkcolor($ar[$i], 0x57FF5C)
endif
case $button1
If $gerundet=0 then
msgbox(0, "Fallo", "Du hast noch nicht gespielt")
Else
GUICtrlSetState($button1, $gui_disable)
$input= Inputbox("Dein Name", "Como se llama?")
If $input<> 0 and $input<> 1 and $input<> 2 and $input<> 3 and $input<> 4 and $input<> 5 and $input<>6 and $input<> 7 and $input<> 8 and $input<> 9 Then
Msgbox(0, "Fallo", "Dein Name darf keine Zahlen beeinhalten")
else
$name= Iniwrite(@ScriptDir&"\score.ini", $input, "1name", $gerundet)
$iniread= IniReadSectionNames(@Scriptdir&"\score.ini")
$armax=_ArrayMax($iniread)
_GUICtrlListView_DeleteAllItems($listview1)
For $j=1 to $armax
guictrlcreatelistviewitem($iniread[$j]&"|"& Iniread(@scriptdir&"\score.ini", $iniread[$j], "1name", ""), $listview1)
next
_GUICtrlListView_SimpleSort($listview1, $B_DESCENDING[1],1)
endif
endif
EndSwitch
wend
http://www.autoit.de/index.php?page=Thr ... d3bc27b864
Salu22:)