Jump to content

Games (3)


JustinReno
 Share

Recommended Posts

Here is my try at making games. It includes three: Match the word Color, Guess a Number, and Intructions.

This is my first try at making games in AutoIt so they might not be the most addictive or funnest. I think the most addictive is Match the Word Color.

All are very easy except intructions. If wanted enough, I'll make them all harder.

And this is also one of my first times using GuiSetOnEvent() and GuiCtrlSetOnEvent().

Bugs: Please Report Them!

ToDo: Make More!

PLEASE PLEASE PLEASE GIVE ME CREDIT! These games are simple, but code that took me a lot of thinking to get it to work.

Match the Word Color Source:

#NoTrayIcon

Global $Data[6] = ["Blue", "Red", "Purple", "Orange", "Green", "Yellow"]
Global $Colors[6] = ["0x3299CC", "0xEE0000", "0x7D26CD", "0xFF6600", "0x308014", "0xFFFF00"]
Global $Color, $Time, $Level

Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Match the word Color", 308, 90)
$ColorButton = GUICtrlCreateButton("", 0, 24, 75, 41, 0)
$Blue = GUICtrlCreateButton("Blue", 152, 0, 75, 25, 0)
$Red = GUICtrlCreateButton("Red", 152, 32, 75, 25, 0)
$Purple = GUICtrlCreateButton("Purple", 152, 64, 75, 25, 0)
$Orange = GUICtrlCreateButton("Orange", 232, 0, 75, 25, 0)
$Green = GUICtrlCreateButton("Green", 232, 32, 75, 25, 0)
$Yellow = GUICtrlCreateButton("Yellow", 232, 64, 75, 25, 0)
GUICtrlSetFont($ColorButton, 16)
_Color()
GUISetState(@SW_SHOW)
AdlibEnable("_Time", 1000)

GUISetOnEvent(-3, "_Check")
GUICtrlSetOnEvent($Blue, "_Check")
GUICtrlSetOnEvent($Red, "_Check")
GUICtrlSetOnEvent($Purple, "_Check")
GUICtrlSetOnEvent($Orange, "_Check")
GUICtrlSetOnEvent($Green, "_Check")
GUICtrlSetOnEvent($Yellow, "_Check")

While 1
    Sleep(100)
WEnd

Func _Check()
    If @GUI_CtrlId = $Blue Then
        If $Colors[$Color] = 0x3299CC Then
            _Color()
        Else
            Beep(100, 100)
        EndIf
    EndIf
    If @GUI_CtrlId = $Red Then
        If $Colors[$Color] = 0xEE0000 Then
            _Color()
        Else
            Beep(100, 100)
        EndIf
    EndIf
    If @GUI_CtrlId = $Purple Then
        If $Colors[$Color] = 0x7D26CD Then
            _Color()
        Else
            Beep(100, 100)
        EndIf
    EndIf
    If @GUI_CtrlId = $Orange Then
        If $Colors[$Color] = 0xFF6600 Then
            _Color()
        Else
            Beep(100, 100)
        EndIf
    EndIf
    If @GUI_CtrlId = $Green Then
        If $Colors[$Color] = 0x308014 Then
            _Color()
        Else
            Beep(100, 100)
        EndIf
    EndIf
    If @GUI_CtrlId = $Yellow Then
        If $Colors[$Color] = 0xFFFF00 Then
            _Color()
        Else
            Beep(100, 100)
        EndIf
    EndIf
    If @GUI_CtrlId = -3 Then Exit
EndFunc   ;==>_Check

Func _Time()
    $Time -= 1
    WinSetTitle($GUI, "", "Match the word Color - " & $Time & "")
    If $Time = 0 Then
        MsgBox(64, "Match the word Color", "You lost on Level: " & $Level & "")
        Exit
    EndIf
EndFunc   ;==>_Time

Func _Color()
    $Color = Random(0, 5, 1)
    GUICtrlSetData($ColorButton, $Data[Random(0, 5, 1) ])
    GUICtrlSetColor($ColorButton, $Colors[$Color])
    $Time = 11
    $Level += 1
    If $Level >= 10 Then $Time = 6
    If $Level >= 20 Then $Time = 4
    If $Level > 25 Then $Time = 3
    If $Level > 30 Then $Time = 2
    If $Level = 35 Then
        MsgBox(64, "Click the color of the word", "Congrats " & @UserName & "! You won the last level 30! I hope you had fun!")
        Exit
    EndIf
EndFunc   ;==>_ColoroÝ÷ Øk²ÆºfÞ­«­¢+Ø9½QÉå%½¸()±½°ÀÌØí1°°ÀÌØí%¹ÁÕаÀÌØíI¹½´°ÀÌØí9ÕµÈ()=ÁÐ ÅÕ½ÐíU%=¹Ù¹Ñ5½ÅÕ½Ðì°Ä¤((ÀÌØíU$ôU%
ÉÑ ÅÕ½ÐíÕÍÌ9ÕµÈÅÕ½Ðì°ÄÜÜ°Øؤ(ÀÌØí1°ôU%
Ñɱ
ÉÑ1° ÅÕ½ÐíÕÍÌ9ÕµÈ ÑݸĹÔÀèÅÕ½Ðì°À°À°ÄÜØ°Äܤ(ÀÌØí%¹ÁÕÐôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°À°ÄØ°ÄØà°ÈĤ(ÀÌØí   ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíÕÍÌÅÕ½Ðì°À°ÐÀ°ÄÜÄ°ÈÔ°À¤)}9Ý9ÕµÈ ¤)U%MÑMÑÑ¡M]}M!=¤()U%MÑ=¹Ù¹Ð ´Ì°ÅÕ½Ðí}չѥ½¹ÌÅÕ½Ðì¤)U%
ÑɱMÑ=¹Ù¹Ð ÀÌØí ÕÑѽ¸°ÅÕ½Ðí}չѥ½¹ÌÅÕ½Ðì¤()]¡¥±Ä(%M±À ÄÀÀ¤)]¹()Õ¹}չѥ½¹Ì ¤(%%U%}
Ñɱ%ôÀÌØí   ÕÑѽ¸Q¡¸($$ÀÌØíÑUÍÉ9ÕµÈôU%
ÑɱI ÀÌØí%¹ÁÕФ($%%ÀÌØíÑUÍÉ9ÕµÈÐìÀÌØí9ÕµÈQ¡¸U%
ÑɱMÑÑ ÀÌØí1°°ÅÕ½ÐíQ½¼!¥ ÅÕ½Ðì¤($%%ÀÌØíÑUÍÉ9յȱÐìÀÌØí9ÕµÈQ¡¸U%
ÑɱMÑÑ ÀÌØí1°°ÅÕ½ÐíQ½¼1½ÜÅÕ½Ðì¤($%%ÀÌØíÑUÍÉ9ÕµÈôÀÌØí9ÕµÈQ¡¸U%
ÑɱMÑÑ ÀÌØí1°°ÅÕ½Ðí
½ÉÉÐÌÌìÅÕ½Ðì¤($%%U%
ÑɱI ÀÌØí1°¤ôÅÕ½Ðí
½ÉÉÐÌÌìÅÕ½ÐìQ¡¸($$%M±À ÌÀÀÀ¤($$%}9Ý9ÕµÈ ¤($%¹%(%¹%(%%U%}
Ñɱ%ô´ÌQ¡¸á¥Ð)¹Õ¹ìôôÐí}չѥ½¹Ì()Õ¹}9Ý9ÕµÈ ¤(%U%
ÑɱMÑÑ ÀÌØí1°°ÅÕ½ÐíÕÍÌ9յȠ   ÑݸĹÔÀèÅÕ½Ðì¤(%U%
ÑɱMÑÑ ÀÌØí%¹ÁÕаÅÕ½ÐìÅÕ½Ðì¤($ÀÌØí9ÕµÈôI½Õ¹¡I¹½´ À°ÔÀ°Ä¤¤)¹Õ¹ìôôÐí}9Ý9ÕµÈoÝ÷ Ø춻¶*'±Ê%¢ºM4ÒÊZËr

Have fun, and please give me suggestions of new games or how to improve the 3 existing ones. Thanks! And please give credit to me on any code you used.

*The Password Generator was not directly copied from AlmarM's Password Creator, I followed the same structer. But just in case: Thanks AlmarM!!

Link to comment
Share on other sites

hmmm.... you've never taken well to my criticism... so Ill find something good every time before something bad. g1: it worked, but would never end. g2: also worked, but quite pointless. g3: decent idea, but left out FileOpen(), and the file didn't exist on my system. g1: was visible, but the orange looked a bit red. g1: wasn't too big, but could be bigger. g3: had 2 commands, but could really use some more. g3: had buttons, but wasn't visually appealing.

Link to comment
Share on other sites

hmmm.... you've never taken well to my criticism... so Ill find something good every time before something bad. g1: it worked, but would never end. g2: also worked, but quite pointless. g3: decent idea, but left out FileOpen(), and the file didn't exist on my system. g1: was visible, but the orange looked a bit red. g1: wasn't too big, but could be bigger. g3: had 2 commands, but could really use some more. g3: had buttons, but wasn't visually appealing.

G1: You have to press the exit button at least twice for it to close because of functions.

G3: FileOpen() isn't even needed. And it should be there.

G3: None of my games had or will have eyecandy, simple.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...