CODICE
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
;End Include
_GDIPlus_Startup()
$zanzara = @ScriptDir&"\images\zanzara.bmp"
$rac = @ScriptDir&"\images\racchetta.bmp"
$punti = 0
$avviato = False
$livello = 1
$ini = @ScriptDir&"\punti.ini"
If not FileExists($zanzara) Then Exitt(1)
; Benvenuto
$benvenuto = GUICreate("Welcome to ZanZare Kill 0.1", 633, 102, 192, 124)
$benv = GUICtrlCreateLabel("Quante Volte le zanzare ti hanno punto?"&@CR&"Vuoi vendicarti??", 64, 16, 324, 37)
$vend = GUICtrlCreateButton("Vendicati!!!", 408, 24, 201, 49, 0)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $vend
Vendicati()
EndSwitch
WEnd
Func Vendicati()
$Gui = GUICreate("Zanzare Kill 0.1", 673, 490, 302, 218)
$Group1 = GUICtrlCreateGroup("Comandi", 8, 8, 649, 73)
$go = GUICtrlCreateButton("Inizia", 24, 32, 75, 25, 0)
$stop = GUICtrlCreateButton("Stop", 104, 32, 75, 25, 0)
$exit = GUICtrlCreateButton("Esci", 184, 32, 75, 25, 0)
$save = GUICtrlCreateButton("Salva punteggio", 264, 32, 99, 25, 0)
GUICtrlCreateLabel("Punteggio: ", 396, 38, 58, 17)
Global $lpunti = GUICtrlCreateLabel("0", 464, 38, 100, 22)
GUICtrlSetFont(-1, 19, 400, 0, "Visitor TT2 (BRK)")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Gioco:", 8, 96, 649, 377)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $image = GUICtrlCreatePic("",25,100,100,100)
GUISetState(@SW_HIDE,$benvenuto)
GUISetState(@SW_SHOW,$Gui)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
stop()
Exit
Case $go
login()
If $cmdline[0] = 1 Then
trucchi()
EndIf
Case $image
If $avviato = True Then
$punti += 2
printp()
EndIf
Case $stop
stop()
Case $exit
stop()
Exit
Case $save
salva()
EndSwitch
WEnd
;End
EndFunc
Func exitt($cod)
If $cod = 1 Then
MsgBox(48,"Errore","Mancano i file necessari per far funzionare il programma")
Exit
Else
salva()
Exit
EndIf
EndFunc
Func salva()
IniWrite($ini,"punteggio","migliore",$punti)
If Not @error Then
MsgBox(64,"Salvato :)","Punteggio salvato :)",3)
Else
MsgBox(48,"Errore nel salvataggio del punteggio","Errore nel salvataggio del punteggio")
EndIf
EndFunc
Func zanzare($file = $zanzara, $zabz = $image)
Local $pos = Random(0,400), $pos2 = Random(60,490)
If IsDeclared("zabz") <> -1 Then
$zabz = $image
EndIf
GUICtrlSetImage($zabz,$zanzara)
ControlMove("","",$zabz,$pos,$pos2)
EndFunc
Func trucchi()
$F1 = GUICreate("Trucchi - Cheat", 633, 115, 192, 124)
$Button1 = GUICtrlCreateButton("Add Score", 16, 8, 593, 41, 0)
$Button2 = GUICtrlCreateButton("Save false score ( 1.000.000 of points)", 16, 56, 595, 41, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
EndFunc
Func printp($lab=$lpunti)
GUICtrlSetData($lab,$punti)
EndFunc
Func login()
Global $avviato = True
GUICtrlSetCursor($image,$rac)
zanzare($zanzara,$image)
AdlibRegister("zanzare",1000)
AdlibRegister("checkLevel")
EndFunc
Func checklevel()
If $livello = 1 And $punti > 50 Then
livellosuccessivo()
ElseIf $livello = 2 And $punti > 80 Then
livellosuccessivo()
Elseif $livello = 3 And $punti > 150 Then
campione()
EndIf
EndFunc
Func livellosuccessivo()
AdlibUnRegister("zanzare")
If $livello = 1 Then
$livello += 1
MsgBox(64,"Livello successivo","Complimeti, hai superato il primo livello!")
AdlibRegister("zanzare",700)
ElseIf $livello = 2 Then
$livello += 1
MsgBox(64,"Livello successivo","Complimeti, hai superato il secondo livello!")
AdlibRegister("zanzare",400)
EndIf
EndFunc
Func campione()
MsgBox(64,"Complimenti","Complimenti, Sei il campione!"&@CR&"Il tuo punteggio è "&$punti&" punti.")
stop()
EndFunc
Func stop()
AdlibUnRegister("zanzare")
AdlibUnRegister("checklevel")
MsgBox(64,"Punteggio","Il tuo punteggio è di: "&$punti)
GUICtrlSetImage($image,"")
GUICtrlSetData($lpunti,0)
$punti = 0
salva()
EndFunc