Jump to content



Photo

Watch Out!


  • Please log in to reply
31 replies to this topic

#1 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 21 June 2008 - 04:18 PM

here it is..
Watch Out!
a nice and addictive game...
press Escape to exit
you begin with 6 lives, every time you come into a next level you get 1 live extra..
if all lives are gone then you're game over..
the point is to avoid the white rectangle with your mouse..

MiscConstants is needed:
Attached File  MiscConstants.au3   4.03K   321 downloads

Old (lame) small window Watch Out:
AutoIt         
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=icoontjes\ICO\VistaICO_Toolbar_Icons\Symbol-Error.ico #AutoIt3Wrapper_outfile=Watch Out!.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <MiscConstants.au3> $setspeed=10 $fireatmouse=false global $toptobottom=false, $lefttoright=false, $righttoleft=false, $bottomtotop=false global $nextgameover=false, $bkcolor='' global $level[11]=[2, 3, 2, 2, 1, 2, 1, 2, 1, 2] global $tk[11]=[25, 40, 50, 75, 90, 100, 120, 130, 150, 160] Opt("GUIOnEventMode", 1) $p = 0 HotKeySet('{ESC}', '_close') #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Watch Out!", 633, 447, -1, -1, $WS_POPUPWINDOW) WinSetOnTop($Form1, '', 1) $tekst = GUICtrlCreateLabel('Score: 0', 0, 0, 100, 50) GUISetBkColor(0x000000) GUICtrlSetFont(-1, 12, 800, 'Arial') GUICtrlSetColor(-1, 0xFFFFFF) $lives = GUICtrlCreateLabel('||||||', 300, 0, 100, 25) GUICtrlSetFont(-1, 15, 800, 'Arial') GUICtrlSetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, '_close') $wpos = WinGetPos($Form1) _MouseTrap($wpos[0], $wpos[1]+10, $wpos[0]+$wpos[2], $wpos[1]+$wpos[3]-10 ) _BeginGame() HotKeySet('{PAUSE}', '_pause') #EndRegion ### END Koda GUI section ### $count=1 GUICtrlSetData($tekst, 'Created by ludocus') Sleep(1000) GUICtrlSetData($tekst, 'Press esc to exit..') Sleep(2000) GUICtrlSetData($tekst, 'Press break to pause..') Sleep(2000) _SetLabel() $graph = GUICtrlCreateGraphic(0, 0, 100, 100) GUICtrlSetBkColor(-1, $bkcolor) GUICtrlSetColor(-1, 0) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 350, 200, 50, 80) $speed=$setspeed While 1     if _NextLvl() then         if $p >= 10 then             GUICtrlSetData($tekst, 'Gratz.. Winner!!')             msgbox(32, 'Congratz!', 'Your the winner of all!!!')             $p=0             $count=0             sleep(2000)             _SetLabel()         Else             GUICtrlSetData($lives, GUICtrlRead($lives)&'|')             GUICtrlSetData($tekst, 'LEVEL '&$p+2)             sleep(2000)             _SetLabel()             $speed=$speed+$level[$p]             $p = $p + 1             $nextgameover=false         EndIf     EndIf         GUICtrlSetData($tekst, 'Score: '&$count)     $count = $count + 1     $pnum = Random(1, 4, 1)     $wpos = WinGetPos($Form1)     $mpos = MouseGetPos()     global $toptobottom=false, $lefttoright=false, $righttoleft=false, $bottomtotop=false     if $pnum = 1 Then         $toptobottom=True         $num = 0         $i = Random(0, 633, 1)         if $fireatmouse=True Then $i = MouseGetPos(1)-$wpos[0]-30     ElseIf $pnum = 2 Then         $i = 0         $lefttoright=True         $num = Random(0, 447, 1)         if $fireatmouse=True Then $num = MouseGetPos(1)-$wpos[1]-30     ElseIf $pnum = 3 Then         $i = 733         $righttoleft=True         $num = Random(0, 447, 1)         if $fireatmouse=True Then $num = MouseGetPos(1)-$wpos[1]-30     ElseIf $pnum = 4 Then         $bottomtotop=True         $num = Random(0, 633, 1)         $i = 547         if $fireatmouse=True Then $i = MouseGetPos(1)-$wpos[0]-30     EndIf     While 1     $wpos = WinGetPos($Form1)     $mpos = MouseGetPos()     if $mpos[0] > $wpos[0]+$wpos[2] or $mpos[1] > $wpos[1]+$wpos[3] then _Cheater()     if $mpos[0] < $wpos[0] or $mpos[1] < $wpos[1] then _Cheater()     if not WinActive($Form1) then WinActivate($Form1)     if $lefttoright=true then         if $i >= 733 then exitloop         GUICtrlSetPos($graph, $i, $num)         $i = $i + $speed     ElseIf $righttoleft=true then         if $i <= -100 then exitloop         GUICtrlSetPos($graph, $i, $num)         $i = $i - $speed     ElseIf $toptobottom=true Then         if $num >= 547 then exitloop         GUICtrlSetPos($graph, $i, $num)         $num = $num + $speed     ElseIf $bottomtotop=true Then         if $num <= -100 then exitloop         GUICtrlSetPos($graph, $i, $num)         $num = $num - $speed     EndIf     sleep(10)     if _ObjectHit($i, $num) then         if $nextgameover = true then _SetGameOver()         GUICtrlSetData($tekst, 'Dead..')         sleep(1000)         GUICtrlSetData($lives, _Create(StringLen(GUICtrlRead($lives))-1))         if StringLen(GUICtrlRead($lives))=0 then $nextgameover=true     EndIf     WEnd WEnd Func _Cheater()     msgbox(262144+16, 'Cheater!!', 'Cheaters are not tolerated.. '&@CRLF&'Goodbye....')     exit EndFunc Func _BeginGame()     $bkcolor=0xFFFFFF     $1 = GUICtrlCreateLabel('Choose color:', 100, 100, 180, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $2 = GUICtrlCreateLabel('F1  --', 100, 130, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xE2CC32)     $3 = GUICtrlCreateLabel('F2  --', 100, 160, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFF0000)     $4 = GUICtrlCreateLabel('F3  --', 100, 190, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0x00FF00)     $5 = GUICtrlCreateLabel('F4  --', 100, 220, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $6 = GUICtrlCreateLabel('(m) Fire at mouse: off', 100, 280, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $7 = GUICtrlCreateLabel('(s) Speed: '&$setspeed, 100, 320, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $8 = GUICtrlCreateLabel('Press space to start..', 300, 360, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $9 = GUICtrlCreateLabel('Press break to pause..', 300, 390, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $10 = GUICtrlCreateLabel('Press escape to exit..', 300, 420, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $graph = GUICtrlCreateGraphic(160, 135, 100, 100)     GUICtrlSetBkColor(-1, 0xffffff)     GUICtrlSetColor(-1, 0)     GUICtrlSetGraphic(-1, $GUI_GR_RECT, 350, 200, 50, 80)     While 1         if _IsPressed($VK_F1) then             GUICtrlSetBkColor($graph, 0xE2CC32)             $bkcolor=0xE2CC32             sleep(100)         EndIf         if _IsPressed($VK_F2) then             GUICtrlSetBkColor($graph, 0xFF0000)             $bkcolor=0xFF0000             sleep(100)         EndIf         if _IsPressed($VK_F3) then             GUICtrlSetBkColor($graph, 0x00FF00)             $bkcolor=0x00FF00             sleep(100)         EndIf         if _IsPressed($VK_F4) then             GUICtrlSetBkColor($graph, 0xFFFFFF)             $bkcolor=0xFFFFFF             sleep(100)         EndIf         if _IsPressed($VK_SPACE) then exitloop         if _IsPressed($VK_M) then             if $fireatmouse=False Then                 $fireatmouse=True                 GUICtrlSetData($6, '(m) Fire at mouse: on')             Else                 $fireatmouse=False                 GUICtrlSetData($6, '(m) Fire at mouse: off')             EndIf             sleep(100)         EndIf         If _IsPressed($VK_S) Then             $setspeed=$setspeed+1             GUICtrlSetData($7, '(s) Speed: '&$setspeed)             if $setspeed=20 then                 $setspeed=1                 GUICtrlSetData($7, '(s) Speed: '&$setspeed)             EndIf                         sleep(100)         EndIf     WEnd     GUICtrlDelete($1)     GUICtrlDelete($2)     GUICtrlDelete($3)     GUICtrlDelete($4)     GUICtrlDelete($5)     GUICtrlDelete($6)     GUICtrlDelete($7)     GUICtrlDelete($8)     GUICtrlDelete($9)     GUICtrlDelete($10)     GUICtrlDelete($graph)     EndFunc Func _Create($count)     global $sReturn=''     for $i = 1 to $count         $sReturn &='|'     Next     return $sReturn EndFunc Func _SetGameOver()     $speed=$setspeed     $nextgameover=false     GUICtrlSetData($tekst, 'Game over.. Score: '&$count)     sleep(2000)     GUICtrlSetData($lives, '||||||')     $count = 0     $p = 0     _SetLabel() EndFunc Func _NextLvl()     if $p = 0 Then         if $count = $tk[$p] then return 1     Else         if $count = ($tk[$p]+$tk[($p-1)]) then return 1     EndIf         return 0 EndFunc Func _SetLabel()     GUICtrlSetData($tekst, 'The game begins in: 3')     Sleep(1000)     GUICtrlSetData($tekst, 'The game begins in: 2')     Sleep(1000)     GUICtrlSetData($tekst, 'The game begins in: 1')     Sleep(1000) EndFunc Func _close()     Exit EndFunc Func _ObjectHit($Ctrl, $num)     $win = WinGetPos($Form1)     $pos = MouseGetPos()     if $pos[0] >= $Ctrl+$win[0] and $pos[0] <= ($Ctrl+$win[0]+100) Then         if $pos[1] >= $num+$win[1] and $pos[1] <= ($num+$win[1]+100) Then             return 1         EndIf     EndIf EndFunc Func _pause()     _MouseTrap()     $label = GUICtrlCreateLabel('Paused', 633/2, 447/2, 400, 200)     GUICtrlSetFont(-1, 30, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $label2 = GUICtrlCreateLabel('Press space to continue', 200, 400, 400, 25)     GUICtrlSetFont(-1, 15, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     WinSetOnTop($Form1, '', 0)     Do         sleep(100)     Until WinActive($Form1) and _IsPressed($VK_SPACE)     $wpos = WinGetPos($Form1)     _MouseTrap($wpos[0], $wpos[1]+10, $wpos[0]+$wpos[2], $wpos[1]+$wpos[3]-10 )     WinSetOnTop($Form1, '', 1)     GUICtrlDelete($label)     GUICtrlDelete($label2) EndFunc


New, Full Screen Watch Out:
AutoIt         
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\Documents and Settings\Ludo\Bureaublad\icoontjes\vista icons\ICO\VistaICO_Toolbar_Icons\Symbol-Error.ico #AutoIt3Wrapper_outfile=Watch Out!.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <MiscConstants.au3> #include <File.au3> #include <StaticConstants.au3> ;ClipPut(_ChooseColor(2)) ;exit $rank = 0 ;easy = 10 ;medium = 20 ;hard = 30 ;impossible = 50 $setspeed=20 $fireatmouse=false global $toptobottom=false, $lefttoright=false, $righttoleft=false, $bottomtotop=false global $nextgameover=false, $bkcolor='', $highscorefile=@AppDataDir&'\Watch Out Highscores.txt' If not FileExists($highscorefile) then FileWrite($highscorefile, '1: MrPowner=100'&@CRLF&'2: DieHard=50'&@CRLF&'3: Noob=25'&@CRLF&'4: Loser=10') global $level[11]=[2, 3, 2, 2, 1, 2, 1, 2, 1, 2] global $tk[11]=[25, 40, 50, 75, 90, 100, 120, 130, 150, 160] Opt("GUIOnEventMode", 1) $p = 0 HotKeySet('{ESC}', '_close') #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Watch Out!", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUPWINDOW) WinSetOnTop($Form1, '', 1) $tekst = GUICtrlCreateLabel('Score: 0', 0, 0, 100, 50) GUISetBkColor(0x000000) GUICtrlSetFont(-1, 12, 800, 'Arial') GUICtrlSetColor(-1, 0xFFFFFF) $lives = GUICtrlCreateLabel('||||||', 300, 0, 100, 25) GUICtrlSetFont(-1, 15, 800, 'Arial') GUICtrlSetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, '_close') $wpos = WinGetPos($Form1) _MouseTrap($wpos[0], $wpos[1]+10, $wpos[0]+$wpos[2], $wpos[1]+$wpos[3]-10 ) _BeginGame() HotKeySet('{PAUSE}', '_pause') #EndRegion ### END Koda GUI section ### $count=1 GUICtrlSetData($tekst, 'Created by ludocus') Sleep(1000) GUICtrlSetData($tekst, 'Press esc to exit..') Sleep(2000) GUICtrlSetData($tekst, 'Press break to pause..') Sleep(2000) _SetLabel() $graph = GUICtrlCreateGraphic(0, 0, 100, 100) GUICtrlSetBkColor(-1, $bkcolor) GUICtrlSetColor(-1, 0) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 350, 200, 50, 80) $speed=$setspeed While 1     if _NextLvl() then         if $p >= 10 then             GUICtrlSetData($tekst, 'Gratz.. Winner!!')             msgbox(32, 'Congratz!', 'You are the winner of all!!!')             $p=0             $count=0             sleep(2000)             _SetLabel()         Else             GUICtrlSetData($lives, GUICtrlRead($lives)&'|')             GUICtrlSetData($tekst, 'LEVEL '&$p+2)             sleep(2000)             _SetLabel()             $speed=$speed+$level[$p]             $p = $p + 1             $nextgameover=false         EndIf     EndIf         GUICtrlSetData($tekst, 'Score: '&$count)     $count = $count + 1     $pnum = Random(1, 4, 1)     ;$wpos = WinGetPos($Form1)     $mpos = MouseGetPos()     global $toptobottom=false, $lefttoright=false, $righttoleft=false, $bottomtotop=false     if $pnum = 1 Then         $toptobottom=True         $num = 0         $i = Random(0, @DesktopWidth, 1)         if $fireatmouse=True Then $i = MouseGetPos(0)+30     ElseIf $pnum = 2 Then         $i = 0         $lefttoright=True         $num = Random(0, @DesktopHeight, 1)         if $fireatmouse=True Then $num = MouseGetPos(1)-30     ElseIf $pnum = 3 Then         $i = @DesktopWidth         $righttoleft=True         $num = Random(0, @DesktopHeight, 1)         if $fireatmouse=True Then $num = MouseGetPos(1)-30     ElseIf $pnum = 4 Then         $bottomtotop=True         $num = @DesktopHeight         $i = Random(0, @DesktopWidth, 1)         if $fireatmouse=True Then $i = MouseGetPos(0)+30     EndIf         While 1     ;$wpos = WinGetPos($Form1)     $mpos = MouseGetPos()     ;if $mpos[0] > $wpos[0]+$wpos[2] or $mpos[1] > $wpos[1]+$wpos[3] then _Cheater()     ;if $mpos[0] < $wpos[0] or $mpos[1] < $wpos[1] then _Cheater()     if not WinActive($Form1) then WinActivate($Form1)     if $lefttoright=true then         if $i >= @DesktopWidth+100 then exitloop         GUICtrlSetPos($graph, $i, $num)         $i = $i + $speed     ElseIf $righttoleft=true then         if $i <= -100 then exitloop         GUICtrlSetPos($graph, $i, $num)         $i = $i - $speed     ElseIf $toptobottom=true Then         if $num >= @DesktopHeight+100 then exitloop         GUICtrlSetPos($graph, $i, $num)         $num = $num + $speed     ElseIf $bottomtotop=true Then         if $num <= -100 then exitloop         GUICtrlSetPos($graph, $i, $num)         $num = $num - $speed     EndIf     sleep(10)     if _ObjectHit($i, $num) then         if $nextgameover = true then _SetGameOver()         GUICtrlSetData($tekst, 'Dead..')         sleep(1000)         GUICtrlSetData($lives, _Create(StringLen(GUICtrlRead($lives))-1))         if StringLen(GUICtrlRead($lives))=0 then $nextgameover=true     EndIf     WEnd WEnd Func _Cheater()     msgbox(262144+16, 'Cheater!!', 'Cheaters are not tolerated.. '&@CRLF&'Goodbye....')     exit EndFunc Func _BeginGame()     $bkcolor=0xFFFFFF     $1 = GUICtrlCreateLabel('Choose color:', 100, 100, 180, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $2 = GUICtrlCreateLabel('F1  --', 100, 130, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0x1115B9)     $3 = GUICtrlCreateLabel('F2  --', 100, 160, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFF0000)     $4 = GUICtrlCreateLabel('F3  --', 100, 190, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0x00FF00)     $5 = GUICtrlCreateLabel('F4  --', 100, 220, 60, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $6 = GUICtrlCreateLabel('(m) Fire at mouse: off', 100, 280, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $7 = GUICtrlCreateLabel('(s) Speed: '&$setspeed, 100, 320, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $8 = GUICtrlCreateLabel('Press space to start..', 300, 360, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $9 = GUICtrlCreateLabel('Press break to pause..', 300, 390, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $10 = GUICtrlCreateLabel('Press escape to exit..', 300, 420, 230, 20)     GUICtrlSetFont(-1, 12, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $11 =  GUICtrlCreateLabel('Highscores:', 690, 80, 180, 30)     GUICtrlSetFont(-1, 16, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $12 = GUICtrlCreateListView('Rank:|Name:|Score:', 585, 140, 350, 449)     GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 46)     GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)     GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150)     GUICtrlSetFont(-1, 10, 400, 'Arial')     GUICtrlSetColor(-1, 0x1115B9)     ;0x6ABBF7     GUICtrlSetBkColor(-1, 0xE22F1B)     GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE)     $graph = GUICtrlCreateGraphic(160, 135, 100, 100)     GUICtrlSetBkColor(-1, 0xffffff)     GUICtrlSetColor(-1, 0)     GUICtrlSetGraphic(-1, $GUI_GR_RECT, 350, 200, 50, 80)     $load = _Load()     _GUICtrlListView_BeginUpdate($12)     For $i = 1 to $load[0]         $currentview = GUICtrlCreateListViewItem($load[$i], $12)         ;0x80C6F9         GUICtrlSetBkColor(-1, 0xEA8D26)     Next     _GUICtrlListView_EndUpdate($12)             While 1         if _IsPressed($VK_F1) then             GUICtrlSetBkColor($graph, 0x1115B9)             $bkcolor=0x1115B9             sleep(100)         EndIf         if _IsPressed($VK_F2) then             GUICtrlSetBkColor($graph, 0xFF0000)             $bkcolor=0xFF0000             sleep(100)         EndIf         if _IsPressed($VK_F3) then             GUICtrlSetBkColor($graph, 0x00FF00)             $bkcolor=0x00FF00             sleep(100)         EndIf         if _IsPressed($VK_F4) then             GUICtrlSetBkColor($graph, 0xFFFFFF)             $bkcolor=0xFFFFFF             sleep(100)         EndIf         if _IsPressed($VK_SPACE) then exitloop         if _IsPressed($VK_M) then             if $fireatmouse=False Then                 $fireatmouse=True                 GUICtrlSetData($6, '(m) Fire at mouse: on')             Else                 $fireatmouse=False                 GUICtrlSetData($6, '(m) Fire at mouse: off')             EndIf             sleep(100)         EndIf         If _IsPressed($VK_S) Then             $setspeed=$setspeed+1             GUICtrlSetData($7, '(s) Speed: '&$setspeed)             if $setspeed>=50 then                 $setspeed=1                 GUICtrlSetData($7, '(s) Speed: '&$setspeed)             EndIf                         sleep(100)         EndIf     WEnd     GUICtrlDelete($1)     GUICtrlDelete($2)     GUICtrlDelete($3)     GUICtrlDelete($4)     GUICtrlDelete($5)     GUICtrlDelete($6)     GUICtrlDelete($7)     GUICtrlDelete($8)     GUICtrlDelete($9)     GUICtrlDelete($10)     GUICtrlDelete($11)     GUICtrlDelete($12)     GUICtrlDelete($graph)     EndFunc Func _Create($count)     global $sReturn=''     for $i = 1 to $count         $sReturn &='|'     Next     return $sReturn EndFunc Func _SetGameOver()     $speed=$setspeed     $nextgameover=false     GUICtrlSetData($tekst, 'Game over.. Score: '&$count)     WinSetOnTop($Form1, '', 0)     $name = InputBox('Highscore', 'What is your name?', '', '', 100, 100, -1, -1)     _Highscore($count, $name)     WinSetOnTop($Form1, '', 1)     sleep(2000)     GUICtrlSetData($lives, '||||||')     $count = 0     $p = 0     _SetLabel() EndFunc Func _NextLvl()     if $p = 0 Then         if $count = $tk[$p] then return 1     Else         if $count = ($tk[$p]+$tk[($p-1)]) then return 1     EndIf         return 0 EndFunc Func _SetLabel()     GUICtrlSetData($tekst, 'The game begins in: 3')     Sleep(1000)     GUICtrlSetData($tekst, 'The game begins in: 2')     Sleep(1000)     GUICtrlSetData($tekst, 'The game begins in: 1')     Sleep(1000) EndFunc Func _close()     Exit EndFunc Func _ObjectHit($Ctrl, $num)     $win = WinGetPos($Form1)     $pos = MouseGetPos()     if $pos[0] >= $Ctrl+$win[0] and $pos[0] <= ($Ctrl+$win[0]+100) Then         if $pos[1] >= $num+$win[1] and $pos[1] <= ($num+$win[1]+100) Then             return 1         EndIf     EndIf EndFunc Func _pause()     _MouseTrap()     $label = GUICtrlCreateLabel('Paused', 633/2, 447/2, 400, 200)     GUICtrlSetFont(-1, 30, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     $label2 = GUICtrlCreateLabel('Press space to continue', 200, 400, 400, 25)     GUICtrlSetFont(-1, 15, 800, 'Arial')     GUICtrlSetColor(-1, 0xFFFFFF)     WinSetOnTop($Form1, '', 0)     Do         sleep(100)     Until WinActive($Form1) and _IsPressed($VK_SPACE)     $wpos = WinGetPos($Form1)     _MouseTrap($wpos[0], $wpos[1]+10, $wpos[0]+$wpos[2], $wpos[1]+$wpos[3]-10 )     WinSetOnTop($Form1, '', 1)     GUICtrlDelete($label)     GUICtrlDelete($label2) EndFunc Func _Load()     $reda = FileRead($highscorefile)     $new1 = StringReplace($reda, ': ', '|')     $new2 = StringReplace($new1, '=', '|')     $return = StringSplit($new2, @CRLF, 1)     return $return EndFunc Func _Highscore($score, $name)     $write = 'niks'     $write1 = 'niks'     If not FileExists($highscorefile) then FileWrite($highscorefile, '1: MrPowner=100'&@CRLF&'2: DieHard=50'&@CRLF&'3: Noob=25'&@CRLF&'4: Loser=10')     $totalfile = FileRead($highscorefile)     if $totalfile = '' Then         FileWrite($highscorefile, '1: MrPowner=100'&@CRLF&'2: DieHard=50'&@CRLF&'3: Noob=25'&@CRLF&'4: Loser=10')         $totalfile = FileRead($highscorefile)     EndIf     $line = StringSplit($totalfile, @CRLF, 1)     $izb = $line[$line[0]]     $lbp = StringSplit($izb, '=', 1)     $lastscore = $lbp[2]     if $score < $lastscore then         $write = $totalfile&@CRLF&($line[0]+1)&': '&$name&'='&$score     Else         For $i = 1 to $line[0]             if $write = 'niks' and $write1 = 'niks' then                 $splitscore = StringSplit($line[$i], '=', 1)                 ;msgbox(0, $score, $splitscore[2])                 if $score >= $splitscore[2] Then                     $split = StringSplit($totalfile, $line[$i], 1)                     if $split[1]='' then                         $write = $i&': '&$name&'='&$score&@CRLF&$line[$i]&$split[2]                     Else                         $write = $split[1]&$i&': '&$name&'='&$score&@CRLF&$line[$i]&$split[2]                     EndIf                     $rank=$i                     $write1 = 'alles'                     $i -= 1                 EndIf                 ;msgbox(0, $write1, $write)             Else                 if $line[$i] = '' then exitloop                 $write = StringReplace($write, $line[$i], ($i+1)&StringRight($line[$i], StringLen($line[$i])-StringLen($i)))                 ;msgbox(0, $line[$i]&' = '&$i, $write)             EndIf         Next     EndIf     FileDelete($highscorefile)     _FileCreate($highscorefile)     ;_FileWriteToLine($highscorefile, 1, $write)     FileWrite($highscorefile, $write)     if $rank = 1 then Msgbox(0, 'Congratulations!', "You got a new highscore: "&$score) EndFunc


Download compiled version here

Changes with update:
-Fullscreen
-Menu at start
-Highscores
-Some bug fixes..

Enjoy:)

Edited by ludocus, 15 September 2010 - 02:15 PM.








#2 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 21 June 2008 - 04:28 PM

It's cool, though you should remove position of the window, cause on this (old PC), my resolution is 800x600, so half of the game screen is cut :)

EDIT: Also it would be awsome if you could make the white square pop up from any part of the window (from right, top, bottom and left) :P Good luck

Edited by sandin, 21 June 2008 - 04:30 PM.


#3 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 21 June 2008 - 04:30 PM

thnx :)

#4 James

James

    jbrooksuk

  • MVPs
  • 9,470 posts

Posted 21 June 2008 - 06:40 PM

When your mouse collides with the block, it should be destroyed.

#5 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,340 posts

Posted 21 June 2008 - 08:11 PM

I got level 6, and 144.. fun game!

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#6 AutoProgramming

AutoProgramming

    Seeker

  • Active Members
  • 37 posts

Posted 21 June 2008 - 09:24 PM

I'll tell ya a cheat that worked for me:

Put you mouse in the top right corner, and you don't get hit very often... once a level maximum ^^
My OpenSource Projects:- [BEEP] proMusiX- Search autorun.inf

#7 DexterMorgan

DexterMorgan

    My Member Title

  • Active Members
  • PipPipPipPipPipPip
  • 890 posts

Posted 21 June 2008 - 10:19 PM

Nice game.. It is fun..
code

#8 NELyon

NELyon

    Do you wanna brew my avatar?

  • Active Members
  • PipPipPipPipPipPip
  • 3,526 posts

Posted 21 June 2008 - 11:16 PM

I got 236. I just played the game normally until I got 200, then I just moved my mouse out of the game area and I never got hit.

#9 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,340 posts

Posted 21 June 2008 - 11:41 PM

found out how to cheat.

Start the game - tap the windows key, and move your mouse outside the block. Bam. Cheat. Win.

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#10 WeMartiansAreFriendly

WeMartiansAreFriendly

    Where's the kaboom?

  • Active Members
  • PipPipPipPipPipPip
  • 1,245 posts

Posted 22 June 2008 - 12:09 AM

Nice simple game, looks good.
Posted ImageDon't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

#11 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 22 June 2008 - 10:53 AM

thnx.. :) I updated the top post..
new functions:
a begin screen
an ability to pause the game
ability to choose option to fire the brick at your mouse
ability to set the speed
ability to choose color of the brick.. :P

#12 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 22 June 2008 - 11:32 AM

Updated it again, try to cheat now :)

#13 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 22 June 2008 - 11:48 AM

I get lots of errors :P
no MiscConstants.au3 file, where did you get it? (I have basic A 3.2.12. version installed with latest scite). and your script is filled with "\" marks :)

#14 James

James

    jbrooksuk

  • MVPs
  • 9,470 posts

Posted 22 June 2008 - 11:57 AM

It's in his signature. Pretty stupid including a file non of us particularly want.

#15 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 22 June 2008 - 12:19 PM

It's in his signature. Pretty stupid including a file non of us particularly want.


ohh... I wasn't looking in his sig :)

ok then, if I add include, and remove "\" marks from script it works, but why does the window needs to be on top even if I pause the game?

p.s. good add to the game would be squares popping up from any side of the game window, not only from the left side :P

#16 James

James

    jbrooksuk

  • MVPs
  • 9,470 posts

Posted 22 June 2008 - 12:23 PM

He has the window style of $WS_EX_TOPMOST, always on top.

#17 sandin

sandin

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 569 posts

Posted 22 June 2008 - 12:37 PM

ya, I've noticed :), but the reason I asked is to make a point that it shouldn't be on top if the game is paused, guistate should be changed. :P

#18 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 22 June 2008 - 01:34 PM

Im very sorry for the miscconstants thingie..
@sandin
yeh that would be cool :)!

#19 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 22 June 2008 - 01:40 PM

updated the pause thing and the always on top thing... :)

#20 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 22 June 2008 - 02:07 PM

I did it!,
the brick now comes from the top, bottom, left or right!
enjoy!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users