A game of icon slots.

2017-05-06 05_50_01-Iconslots

Speaking of slots, here’s an AutoIt version that has a nice twist to it. Instead of using numbers, it uses the icons stored in SHELL32.DLL. If you get three matching icons, you win. However, victory won’t come so easily this time, just like the real thing.

#include <ButtonConstants.au3>
#include <GUIConstants.au3>

GUICreate("Iconslots" , 120, 90)

GUISetState()  ; display the GUI
$quest1 = GUICtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 24)
$quest2 = GUICtrlCreateButton("2", 40, 00, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 24)
$quest3 = GUICtrlCreateButton("3", 80, 00, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 24)
$spin = GUICtrlCreateButton("Go", 35, 50, 50, 35)

Do
$msg = GUIGetMsg()
Select
Case $msg=$spin
GUICtrlDelete ($quest1)
GUICtrlDelete ($quest2)
GUICtrlDelete ($quest3)
$a=random (15,20,1)
$b=random (15,20,1)
$c=random (15,20,1)
$na="-"&$a
$nb="-"&$b
$nc="-"&$c
$button1 = GUICtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", $na)
$button2 = GUICtrlCreateButton("2", 40, 00, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", $nb)
$button3 = GUICtrlCreateButton("3", 80, 00, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", $nc)
if $a=$b and $a=$c and $b=$c Then
GUICtrlDelete ($spin)
GUICtrlCreateLabel ("You win!", 1, 75, 50, 35)
endif
EndSelect
Until $msg = $GUI_EVENT_CLOSE

In a future version I will make gold coins fall from your screen.

Advertisements

Tags:

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: