Jump to content

Game for children


BugFix
 Share

Recommended Posts

Hi,

i've made a little game for children.

With the animal voice riddle it is a matter of recognising successively 10 animal voices.

There sounds at first the animal voice, then a GUI with 30 animal pictures (arrangement every time alternately) is faded in. According to level you have 30, 20, 10 or 5 second time to click on the right picture. Besides, a point value of 100 counts against 0. It is clicked on the picture, the point value stops and is added to the whole points, if it is the right picture.

A high score with 10 entries for every level is led.

In the practise fashion all pictures are faded in and with click sounded the accompanying sound.

All used icons are as source in an own dll-file. Used sounds and dll-file are attached as zip-file. Put sound-folder and dll-file into the script folder. An ini-file, to store last player and highscores, will created by 1.st run.

Enjoy and have fun. :D

#cs
    Animal voice riddle
    after hearing an animal voice the suitable picture must be assigned

    Sources
        Sounds          www.partnersinrhyme.com
                        www.infilmserver.de

        Icon/Cliparts   www.iconspedia.com
                        www.123gif.de
                        www.clipartarchiv.de
                        www.grafikseite.de

    According to licence information of the respective suppliers,
    the contents can be used for the non-commercial use freely.
#ce

; AutoIt version 3.3.2.0
#include <Array.au3>
Opt("GUIOnEventMode", 1)

Global $INI = @ScriptDir & '\animalgame.ini'
If Not FileExists($INI) Then
    IniWrite($INI, 'difficulty', 'current', 'easy')
    IniWrite($INI, 'player', 'last', '')
    Local $aSection[10][2]
    For $i = 1 To 10
        $aSection[$i-1][0] = 0
        $aSection[$i-1][1] = $i & '|player|0|date'
    Next
    For $i = 1 To 4
        IniWriteSection($INI, 'highscore' & $i, $aSection, 0)
    Next
EndIf
Global $difficulty, $tmpDiff, $sliderVal, $lastPlayer = IniRead($INI, 'player', 'last', 'NEW')
Global $aHigh1, $aHigh2, $aHigh3, $aHigh4
_scoreRead()
Global $minScore1 = _Array2DMinMax($aHigh1, 0, 0, 1), $minScore2 = _Array2DMinMax($aHigh2, 0, 0, 1)
Global $minScore3 = _Array2DMinMax($aHigh1, 0, 0, 1), $minScore4 = _Array2DMinMax($aHigh2, 0, 0, 1)
Switch IniRead($INI, 'difficulty', 'current', 'easy')
    Case 'easy'
        $difficulty = 300
        $sliderVal = 100
    Case 'middle'
        $difficulty = 200
        $sliderVal = 67
    Case 'heavy'
        $difficulty = 100
        $sliderVal = 33
    Case 'extreme'
        $difficulty = 50
        $sliderVal = 0
EndSwitch
Global $GUI_score, $GUI_game, $GUI_ico, $titel = 'Which animal speaks here?', $spc = '        '
Global $btHear, $btGame, $btNewGame, $btHighScore, $progress, $hSlider, $bkCol = 0x1E90FF, $txtCol = 0xDC143C
Global $Violet = 0xEE82EE, $Gold = 0xFFD700, $NavajoWhite = 0xFFDEAD, $DarkGreen = 0x006400
Global $hSliderScore, $pathSND = @ScriptDir & '\SND\', $pathDll = @ScriptDir & '\animalgame.dll'
If Not FileExists($pathSND) Or Not FileExists($pathDll) Then Exit MsgBox(0, 'Error', 'Resources missed!')
Global $aIcon[30][2], $aIconNr[30][2] = [ _
[1,'MONKEY'],[2,'BEE'],[3,'DOLPHIN'],[4,'ELEPHANT'],[5,'DUCK'],[6,'OWL'],[7,'FLY'],[8,'FROG'],[9,'CRICKET'],[10,'COCK'], _
[11,'CHICKEN'],[12,'HYENA'],[13,'CAMEL'],[14,'COW'],[15,'LION'],[16,'RHINOCEROS'],[17,'HIPPO'],[18,'HORSE'],[19,'PENGUIN'], _
[20,'SEAL'],[21,'SHEEP'],[22,'PIG'],[23,'SEA LION'],[24,'WOODPECKER'],[25,'TIGER'],[26,'TURKEYCOCK'],[27,'WHALE'],[28,'WOLF'], _
[29,'ZEBRA'],[30,'GOAT']]
Global $picOK = 41, $picNO = 42
Global $playSound = 0, $clicked = 0, $lPoints, $lWholePoints, $WholePoints = 0, $test = 0, $count = 100, $round = 0, $sndNr
Global $started = 0, $aGameSnd, $PictOK = 0, $openMain = 0, $callFromGame = 0

#region - Score
$GUI_score = GUICreate($titel & $spc & '[ Highscore ]', 400, 300)
GUISetOnEvent(-3, '_endScore')
GUISetBkColor($bkCol)
GUICtrlCreateIcon($pathDll, 4, 5, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 5, 95, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 24, 195, 5, 48, 48)
$lvScore = GUICtrlCreateListView(' |Name|Points|Date', 10, 60, 240, 186, 0x0001, 0x00000001)
GUICtrlSetBkColor(-1, $NavajoWhite)
GUICtrlSetFont(-1, 8.5, 400, Default, 'Comic Sans MS')
GUICtrlSendMsg(-1, 0x101E, 0, 20)
GUICtrlSendMsg(-1, 0x101E, 1, 90)
GUICtrlSendMsg(-1, 0x101E, 2, 50)
GUICtrlSendMsg(-1, 0x101E, 3, -2)
GUICtrlCreateLabel('Level', 280, 10, 100, 40)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $NavajoWhite)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$hSliderScore = GUICtrlCreateSlider(270, 55, 30, 220, BitOR(0x0000,0x0002))
GUICtrlSetOnEvent(-1, '_setSlider')
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $txtCol)
GUICtrlSetData($hSliderScore, $sliderVal)
GUICtrlCreateIcon($pathDll, 31, 310, 50, 48, 48) ; extrem
GUICtrlCreateIcon($pathDll, 32, 310, 110, 48, 48); schwer
GUICtrlCreateIcon($pathDll, 33, 310, 170, 48, 48); mittel
GUICtrlCreateIcon($pathDll, 34, 310, 230, 48, 48); leicht
GUICtrlCreateIcon($pathDll, 3, 10, 252, 48, 48)
GUICtrlCreateIcon($pathDll, 10, 86, 252, 48, 48)
GUICtrlCreateIcon($pathDll, 19, 160, 252, 48, 48)
$btClose = GUICtrlCreateButton('', 218, 260, 32, 32, 0x0040)
GUICtrlSetOnEvent(-1, '_endScore')
GUICtrlSetImage(-1, $pathDll, 35)
ControlFocus($GUI_score, '', $btClose)
#endregion

#region - Game
$GUI_game = GUICreate($titel & $spc & '[ Game ]', 400, 300)
GUISetOnEvent(-3, '_endGame')
GUISetBkColor($bkCol)
GUICtrlCreateIcon($pathDll, 1, 5, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 2, 71, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 3, 137, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 4, 203, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 5, 269, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 10, 335, 5, 48, 48)
GUICtrlCreateLabel('Guess successively 10 animals.', 20, 60, 380, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $txtCol)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
GUICtrlCreateLabel('Round', 180, 140, 80, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $txtCol)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$lAnzahl = GUICtrlCreateLabel('0', 280, 140, 100, 30, 0x0002)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $DarkGreen)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
GUICtrlCreateLabel('Go on !', 20, 140, 80, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $NavajoWhite)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$btSound = GUICtrlCreateButton('play', 128, 142, 32, 32, 0x0040)
GUICtrlSetImage(-1, $pathDll, 36)
GUICtrlSetOnEvent(-1, '_playSND')
GUICtrlCreateLabel('Points', 180, 180, 80, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $txtCol)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$lWholePoints = GUICtrlCreateLabel('0', 280, 180, 100, 30, 0x0002)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $DarkGreen)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
GUICtrlCreateLabel('New ?', 20, 180, 80, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $NavajoWhite)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$btNewGame = GUICtrlCreateButton('Again ?', 128, 182, 32, 32, 0x0040)
GUICtrlSetImage(-1, $pathDll, 37)
GUICtrlSetOnEvent(-1, '_playAgain')
GUICtrlSetState($btNewGame, 128)
GUICtrlCreateLabel('Your name', 20, 100, 150, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $Gold)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$inName = GUICtrlCreateInput('', 180, 100, 200, 32, BitOR(0x0008,0x0001))
GUICtrlSetBkColor(-1, $NavajoWhite)
GUICtrlSetColor(-1, $DarkGreen)
GUICtrlSetFont(-1, 16, 400, Default, 'Comic Sans MS')
GUICtrlSetData(-1, $lastPlayer)
GUICtrlCreateIcon($pathDll, 24, 5, 238, 48, 48)
GUICtrlCreateIcon($pathDll, 29, 71, 238, 48, 48)
GUICtrlCreateIcon($pathDll, 21, 137, 238, 48, 48)
GUICtrlCreateIcon($pathDll, 12, 203, 238, 48, 48)
$pic = GUICtrlCreateIcon($pathDll, $picOK, 260, 230, 64, 64)
GUICtrlSetState(-1, 32)
$btEnde = GUICtrlCreateButton('', 348, 248, 32, 32, 0x0040)
GUICtrlSetOnEvent(-1, '_endGame')
GUICtrlSetImage(-1, $pathDll, 35)
#endregion

#region - Main
$GUI_main = GUICreate($titel & $spc & '[ Start ]', 400, 300)
GUISetOnEvent(-3, '_endMain')
GUISetBkColor($bkCol)
GUICtrlCreateIcon($pathDll, 22, 5, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 15, 95, 5, 48, 48)
GUICtrlCreateIcon($pathDll, 16, 195, 5, 48, 48)
GUICtrlCreateLabel('Practise', 21, 50, 120, 30)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $Violet)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$btHear = GUICtrlCreateButton('Listen', 180, 55, 32, 32, 0x0040)
GUICtrlSetOnEvent(-1, '_modeHear')
GUICtrlSetImage(-1, $pathDll, 38)
GUICtrlCreateLabel('Level', 280, 10, 100, 40)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $NavajoWhite)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
GUICtrlCreateLabel('Highscore', 20, 101, 150, 40)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $Gold)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$btHighScore = GUICtrlCreateButton('', 180, 106, 32, 32, 0x0040)
GUICtrlSetOnEvent(-1, '_score')
GUICtrlSetImage(-1, $pathDll, 39)
$hSlider = GUICtrlCreateSlider(270, 55, 30, 220, BitOR(0x0000,0x0002))
GUICtrlSetOnEvent(-1, '_setSlider')
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $txtCol)
GUICtrlSetData($hSlider, $sliderVal)
GUICtrlCreateIcon($pathDll, 31, 310, 50, 48, 48)
GUICtrlCreateIcon($pathDll, 32, 310, 110, 48, 48)
GUICtrlCreateIcon($pathDll, 33, 310, 170, 48, 48)
GUICtrlCreateIcon($pathDll, 34, 310, 230, 48, 48)
GUICtrlCreateLabel('Play', 20, 155, 90, 40)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $DarkGreen)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
$btGame = GUICtrlCreateButton('Play begin', 180, 160, 32, 32, 0x0040)
GUICtrlSetOnEvent(-1, '_runGame')
GUICtrlSetImage(-1, $pathDll, 40)
GUICtrlCreateLabel('Exit', 20, 240, 70, 40)
GUICtrlSetBkColor(-1, $bkCol)
GUICtrlSetColor(-1, $txtCol)
GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
GUICtrlCreateIcon($pathDll, 14, 10, 190, 48, 48)
GUICtrlCreateIcon($pathDll, 29, 120, 150, 48, 48)
GUICtrlCreateIcon($pathDll, 17, 220, 190, 48, 48)
GUICtrlCreateIcon($pathDll, 1, 100, 230, 48, 48)
$btEnde = GUICtrlCreateButton('', 180, 240, 32, 32, 0x0040)
GUICtrlSetOnEvent(-1, '_endMain')
GUICtrlSetImage(-1, $pathDll, 35)
GUISetState()
#endregion
ControlFocus($GUI_main, '', $btHear)

While 1
    Sleep(100)
WEnd

Func _endScore()
    $difficulty = $tmpDiff
    $openMain = 1
    GUISetState(@SW_SHOW, $GUI_main)
    GUISetState(@SW_HIDE, $GUI_score)
EndFunc

Func _endMain()
    Exit
EndFunc

Func _endICO()
    SoundPlay("")
    GUIDelete($GUI_ico)
    If $test Then Return GUISetState(@SW_SHOW, $GUI_main)
    $round += 1
    If $round = 10 Then
        GUICtrlSetState($btSound, 128)
        GUICtrlSetState($btNewGame, 64)
        _checkHighscore()
    Else
        GUICtrlSetState($btSound, 64)
    EndIf
    GUICtrlSetData($lAnzahl, $round)
    GUISetState(@SW_SHOW, $GUI_game)
    AdlibUnRegister('_setProgress')
    GUIDelete($GUI_ico)
    $clicked = 0
    $started = 0
    If BitAND(GUICtrlGetState($pic), 32) Then GUICtrlSetState($pic, 16)
EndFunc

Func _endGame()
    If $round < 10 Then
        If MsgBox(262180, 'Quit current game', 'You really want to break off the current play?' & @LF & _
            'Then the points from this play are not evaluated.') = 7 Then Return
    EndIf
    $round = 0
    $WholePoints = 0
    $started = 0
    GUICtrlSetState($pic, 32)
    GUICtrlSetData($lWholePoints, 0)
    GUICtrlSetData($lAnzahl, 0)
    GUISetState(@SW_HIDE, $GUI_game)
    GUISetState(@SW_SHOW, $GUI_main)
EndFunc

Func _setSlider()
    Local $ID = @GUI_CtrlId
    If $openMain Then $ID = $hSlider
    Local $tmp = GUICtrlRead($ID)
    Select
        Case $tmp < 17
            GUICtrlSetData($ID, 0)
            $difficulty = 50
            If $ID = $hSlider Then IniWrite($INI, 'difficulty', 'current', 'extreme')
        Case $tmp > 16 And $tmp < 49
            GUICtrlSetData($ID, 33)
            $difficulty = 100
            If $ID = $hSlider Then IniWrite($INI, 'difficulty', 'current', 'heavy')
        Case $tmp > 48 And $tmp < 82
            GUICtrlSetData($ID, 66)
            $difficulty = 200
            If $ID = $hSlider Then IniWrite($INI, 'difficulty', 'current', 'middle')
        Case Else
            GUICtrlSetData($ID, 100)
            $difficulty = 300
            If $ID = $hSlider Then IniWrite($INI, 'difficulty', 'current', 'easy')
    EndSelect
    If $openMain Then $openMain = 0
    If $ID = $hSliderScore Then _setLV()
EndFunc

Func _modeHear()
    $test = 1
    GUISetState(@SW_HIDE, $GUI_main)
    _setIcon()
EndFunc

Func _score()
    $tmpDiff = $difficulty
    _setLV()
    GUISetState(@SW_HIDE, $GUI_main)
    GUISetState(@SW_SHOW, $GUI_score)
EndFunc

Func _setLV()
    Local $aScore
    Switch $difficulty
        Case 50
            GUICtrlSetData($hSliderScore, 0)
            $aScore = $aHigh4
        Case 100
            GUICtrlSetData($hSliderScore, 33)
            $aScore = $aHigh3
        Case 200
            GUICtrlSetData($hSliderScore, 66)
            $aScore = $aHigh2
        Case 300
            GUICtrlSetData($hSliderScore, 100)
            $aScore = $aHigh1
    EndSwitch
    GUICtrlSendMsg($lvScore, 0x1009, 0, 0)
    For $i = 1 To UBound($aScore) -1
        GUICtrlCreateListViewItem($aScore[$i][1], $lvScore)
    Next
EndFunc

Func _checkHighscore()
    Local $aScore
    Switch $difficulty
        Case 50
            $aScore = $aHigh4
        Case 100
            $aScore = $aHigh3
        Case 200
            $aScore = $aHigh2
        Case 300
            $aScore = $aHigh1
    EndSwitch
    If $WholePoints < $aScore[10][0] Then Return
    Local $aTmp[UBound($aScore)][2]
    For $i = 1 To UBound($aScore) -1
        $aTmp[$i-1][0] = $aScore[$i][0]
        $aTmp[$i-1][1] = $aScore[$i][1]
    Next
    $lastPlayer = GUICtrlRead($inName)
    IniWrite($INI, 'player', 'last', $lastPlayer)
    $aTmp[10][0] = $WholePoints
    $aTmp[10][1] = '11|' & $lastPlayer & '|' & $WholePoints & '|' & @YEAR & '-' & @MON & '-' & @MDAY
    _ArraySort($aTmp, 1)
    For $i = 0 To 9
        $aTmp[$i][1] = $i+1 & StringTrimLeft($aTmp[$i][1], StringInStr($aTmp[$i][1], '|')-1)
    Next
    For $i = 1 To UBound($aScore) -1
        $aScore[$i][0] = $aTmp[$i-1][0]
        $aScore[$i][1] = $aTmp[$i-1][1]
    Next
    Local $section = 'highscore'
    Switch $difficulty
        Case 50
            $section &= 4
        Case 100
            $section &= 3
        Case 200
            $section &= 2
        Case 300
            $section &= 1
    EndSwitch
    IniWriteSection($INI, $section, $aScore)
    SoundPlay(@WindowsDir & '\Media\tada.wav')
    _scoreRead()
EndFunc

Func _runGame()
    If Not $started Then
        _get10RndSnd()
        $started = 1
    EndIf
    $test = 0
    GUICtrlSetData($inName, $lastPlayer)
    GUISetState(@SW_HIDE, $GUI_main)
    GUISetState(@SW_SHOW, $GUI_game)
EndFunc

Func _get10RndSnd()
    Local $i = 0, $rnd, $sRnd = ''
    Do
        $rnd = Random(0, 29, 1)
        If Not StringInStr($sRnd, $rnd) Then
            $sRnd &= $rnd & ' '
            $i += 1
        EndIf
    Until $i = 10
    $aGameSnd = StringSplit(StringTrimRight($sRnd, 1), ' ', 2)
EndFunc

Func _playSND()
    If GUICtrlRead($inName) = '' Then Return MsgBox(262192, 'Attention!', 'Please type in your name.')
    GUICtrlSetState($btSound, 128)
    SoundPlay($pathSND & $aIconNr[$aGameSnd[$round]][1] & '.mp3', 1)
    GUISetState(@SW_HIDE, $GUI_game)
    _setIcon()
EndFunc

Func _playAgain()
    $WholePoints = 0
    $round = 0
    GUICtrlSetData($lAnzahl, 0)
    GUICtrlSetData($lWholePoints, 0)
    GUICtrlSetState($btNewGame, 128)
    GUICtrlSetState($btSound, 64)
    GUICtrlSetState($pic, 32)
    _get10RndSnd()
EndFunc

Func _Iconclick()
    $clicked = 1
    For $i = 0 To UBound($aIcon) -1
        If $aIcon[$i][0] = @GUI_CtrlId Then
            $PictOK = 0
            GUICtrlSetImage($pic, $pathDll, $picNO)
            If Not $test Then
                If $aGameSnd[$round] = $aIcon[$i][1]-1 Then
                    $PictOK = 1
                    GUICtrlSetImage($pic, $pathDll, $picOK)
                EndIf
            EndIf
            WinSetTitle($GUI_ico, '', '>> ' & $aIconNr[$aIcon[$i][1]-1][1] & ' <<')
            SoundPlay($pathSND & $aIconNr[$aIcon[$i][1]-1][1] & '.mp3')
            _ToolTipMouseExit($aIconNr[$aIcon[$i][1]-1][1], 8000)
            ExitLoop
        EndIf
    Next
    WinSetTitle($GUI_ico, '', $titel)
EndFunc

Func _setIcon()
    $GUI_ico = GUICreate($titel, 800, 740)
    GUISetOnEvent(-3, '_endICO')
    GUISetBkColor(0xFFFFFF)
    If $test Then
        GUICtrlCreateLabel('Click on an animal and sound his voice.', 16, 15, 708, 35, 0x0001)
        GUICtrlSetBkColor(-1, 0xFFFFFF)
        GUICtrlSetColor(-1, 0xFF0000)
        GUICtrlSetFont(-1, 18, 600, Default, 'Comic Sans MS')
    Else
        $progress = GUICtrlCreateProgress(16, 25, 656, 20)
        GUICtrlSetBkColor(-1, 0xFFFFFF)
        GUICtrlSetColor(-1, 0xFF0000)
        $lPoints = GUICtrlCreateLabel('100', 710, 30, 60, 30)
        AdlibRegister('_setProgress', $difficulty)
        $count = 100
        GUICtrlSetColor(-1, 0xFF0000)
        GUICtrlSetFont(-1, 16, 600, Default, 'Comic Sans MS')
    EndIf
    Local $aRand[30] = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]
    Local $s = '', $rand, $aOrder
    For $i = 1 To 30
        $rand = Random(0, UBound($aRand)-1, 1)
        $s &= $aRand[$rand] & ' '
        $aRand[$rand] = $aRand[UBound($aRand)-1]
        If UBound($aRand) > 1 Then ReDim $aRand[UBound($aRand)-1]
    Next
    $aOrder = StringSplit(StringTrimRight($s, 1), ' ', 2)
    Local $x = 16, $y = 70
    For $i = 0 to 29
        $aIcon[$i][0] = GUICtrlCreateIcon($pathDll, $aIconNr[$aOrder[$i]][0], $x, $y, 128, 128)
        $aIcon[$i][1] = $aIconNr[$aOrder[$i]][0]
        GUICtrlSetOnEvent($aIcon[$i][0], '_Iconclick')
        Switch $i
            Case 5, 11, 17, 23
                $x = 16
                $y += 128
            Case Else
                $x += 128
        EndSwitch
    Next
    GUISetState()
EndFunc

Func _setProgress()
    If $clicked Then AdlibUnRegister('_setProgress')
    $count -= 1
    If $count = 0 Then AdlibUnRegister('_setProgress')
    GUICtrlSetData($progress, $count)
    GUICtrlSetData($lPoints, $count)
    If $clicked Then
        If $PictOK Then
            $WholePoints += $count
            GUICtrlSetData($lWholePoints, $WholePoints)
        EndIf
        Sleep(1000)
        _endICO()
    EndIf
EndFunc

Func _scoreRead()
    $aHigh1 = IniReadSection($INI, 'highscore1')
    $aHigh2 = IniReadSection($INI, 'highscore2')
    $aHigh3 = IniReadSection($INI, 'highscore3')
    $aHigh4 = IniReadSection($INI, 'highscore4')
EndFunc

Func _ToolTipMouseExit($TEXT, $TIME=-1, $x=-1, $y=-1, $TITLE='', $ICON=0, $OPT='')
    If $TIME = -1 Then $TIME = 3000
    Local $start = TimerInit(), $pos0 = MouseGetPos()
    If ($x = -1) Or ($y = -1) Then
        ToolTip($TEXT, $pos0[0] +10, $pos0[1], $TITLE, $ICON, $OPT)
    Else
        ToolTip($TEXT, $x, $y, $TITLE, $ICON, $OPT)
    EndIf
    Do
        Sleep(50)
        $pos = MouseGetPos()
    Until (TimerDiff($start) > $TIME) Or _
        (Abs($pos[0] - $pos0[0]) > 10 Or _
         Abs($pos[1] - $pos0[1]) > 10)
    ToolTip('')
EndFunc ;_ToolTipMouseExit

;===============================================================================
; Function Name:   _Array2DMinMax(ByRef $ARRAY, $MAX=0, $iCol=0, $iStart=0, $iEnd=0)
; Description::    Returns minimal or maximal value of an 1D/2D-Array
;                  Check in one or all columns
;                  Numeric compare
; Parameter(s):    $ARRAY   array to check
;                  $MAX     0 = get min value (default); 1 = get max value
;                  $iCol    index of column     0 = default
;                                              -1 = check all columns
;                  $iStart  starting index      0 = default
;                  $iEnd    end index           0 = default (up to last element)
; Return Value(s): Success  min- or max value
;                  Error    -1    @error = 1    no array given
;                                 @error = 2    $iCol greater than UBound,2
; Author(s):       BugFix (bugfix@autoit.de)
;===============================================================================
Func _Array2DMinMax(ByRef $ARRAY, $MAX=0, $iCol=0, $iStart=0, $iEnd=0)
    If Not IsArray($ARRAY) Then Return SetError(1,0,-1)
    If $MAX <> 0 Then $MAX = 1
    If $iEnd = 0 Then $iEnd = UBound($ARRAY) -1
    Local $Ub2nd = UBound($ARRAY, 2)-1, $tmp = 0
    If @error Then
        For $i = $iStart To $iEnd
            If $MAX = 1 Then
                If Number($ARRAY[$i]) > $tmp Then $tmp = Number($ARRAY[$i])
            Else
                If $i = $iStart Then $tmp = Number($ARRAY[$i])
                If Number($ARRAY[$i]) < $tmp Then $tmp = Number($ARRAY[$i])
            EndIf
        Next
    Else
        If $iCol > $Ub2nd Then Return SetError(2,0,-1)
        If $iCol < -1 Then $iCol = -1
        If $iCol = -1 Then
            For $i = $iStart To $iEnd
                For $k = 0 To $Ub2nd
                    If $MAX = 1 Then
                        If Number($ARRAY[$i][$k]) > $tmp Then $tmp = Number($ARRAY[$i][$k])
                    Else
                        If $i = $iStart Then $tmp = Number($ARRAY[$i][$k])
                        If Number($ARRAY[$i][$k]) < $tmp Then $tmp = Number($ARRAY[$i][$k])
                    EndIf
                Next
            Next
        Else
            For $i = $iStart To $iEnd
                If $MAX = 1 Then
                    If Number($ARRAY[$i][$iCol]) > $tmp Then $tmp = Number($ARRAY[$i][$iCol])
                Else
                    If $i = $iStart Then $tmp = Number($ARRAY[$i][$iCol])
                    If Number($ARRAY[$i][$iCol]) < $tmp Then $tmp = Number($ARRAY[$i][$iCol])
                EndIf
            Next
        EndIf
    EndIf
    Return $tmp
EndFunc  ;==>_Array2DMinMax

Here some views:

Main window

http://www.imgbox.de/show/up/BugFix/main.png

Exercise window

http://www.imgbox.de/show/up/BugFix/exercise.png

Highscore

http://www.imgbox.de/show/up/BugFix/highscore.png

False answer

http://www.imgbox.de/show/up/BugFix/false.png

Right answer

http://www.imgbox.de/show/up/BugFix/ok.png

Running game

http://www.imgbox.de/show/up/BugFix/running_game.png

Attached file is greater than 1 MB, so i've hosted it on my web-space:

www.bug-fix.info/animalgame.dll.zip

Edited by BugFix

Best Regards BugFix  

Link to comment
Share on other sites

Nice idea BugFix!

What I'm missing is when you click on a wrong/correct animal pic that the kid gets informed afterwards about it in a better way! The smiley is too small!

Let me say if you click on the right animal an applaus should be heard or on the wrong animal a "oh no" sound!

Regards,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Cool game. Funny pictures and sounds!

This will be very attractive to children.

One question (or bug)?

In practice mode, is there a button or hotkey to return to the main window.

I didn't find it and had to close the window and restart the game.

Link to comment
Share on other sites

Thanks for your reply.

Let me say if you click on the right animal an applaus should be heard or on the wrong animal a "oh no" sound!

You're right. I'll change this at next.

One question (or bug)?

In practice mode, is there a button or hotkey to return to the main window.

I didn't find it and had to close the window and restart the game.

By closing window, you get back to the main window. Don't need a restart.

You possibly use another OS as Win XP? Maybe there is another behavior than.

Best Regards BugFix  

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...