cppman Posted July 13, 2006 Share Posted July 13, 2006 (edited) Completely rewrote it . Better scoring technique and collision detection. *added countdown + timer. expandcollapse popup#include <GUIConstants.au3> $pos = MouseGetPos() Global Const $COLOR_BLACK = 0x000000 Global Const $COLOR_WHITE = 0xFFFFFF Global Const $CLOWN_WIDTH = 32 Global Const $CLOWN_HEIGHT = 32 Global $CLOWN_CURX = 250 Global $CLOWN_CURY = 250 Global $CLOWN_IMAGE = "clown.bmp" Global $CLOWN_HSPEEd = 1.5 Global $CLOWN_VSPEED = 1 Global $MOUSE_X = $pos[0] Global $MOUSE_Y = $pos[1] Global $CUR_SCORE = 0 Global $CUR_TIMELEFT = 15 GUICreate("Catch The Clown! (Updated)", 500, 500) GUISetBkColor( $COLOR_BLACK ) $CLOWN = GUICtrlCreatePic($CLOWN_IMAGE, $CLOWN_CURX, $CLOWN_CURY, $CLOWN_WIDTH, $CLOWN_HEIGHT) $score_lb = GUICtrlCreateLabel("Score: " & $CUR_SCORE, 0, 0, 500) $time_time = GUICtrlCreateLabel("Time Remaining: " & $CUR_TIMELEFT & " seconds.", 0, 25, 500, 500) GUICtrlSetColor($score_lb, $COLOR_WHITE) GUICtrlSetColor($time_time, $COLOR_WHITE) GUICtrlSetBkCOlor($CLOWN, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkCOlor($score_lb, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkCOlor($time_time, $GUI_BKCOLOR_TRANSPARENT) GUISetState() ;Add Timing _CreateTimer("Count", 1) ;1 second While (GUIGetMsg() <> -3) if (_IsClicked()) Then ;Get whether we are at a positive or negative speed if (StringInStr(String($CLOWN_HSPEED), "-")) Then $CLOWN_HSPEED += -.05 Else $CLOWN_HSPEED += .05 EndIf if (StringInStr(String($CLOWN_VSPEED), "-")) Then $CLOWN_VSPEED += -.05 Else $CLOWN_VSPEED += .05 EndIf $CUR_SCORE += 1 EndIf if ($CLOWN_CURX >= (500-$CLOWN_WIDTH)) then SoundPlay("bounce.wav", 0) $CLOWN_HSPEED *= -1 EndIf if ($CLOWN_CURX <= 0) then SoundPlay("bounce.wav", 0) $CLOWN_HSPEED *= -1 EndIf if ($CLOWN_CURY >= 500-$CLOWN_HEIGHT) then SoundPlay("bounce.wav", 0) $CLOWN_VSPEED *= -1 EndIf if ($CLOWN_CURY <= 0) then SoundPlay("bounce.wav", 0) $CLOWN_VSPEED *= -1 EndIf $CLOWN_CURX += $CLOWN_HSPEED $CLOWN_CURY += $CLOWN_VSPEED ControlMove("Catch The Clown! (Updated)", "", $CLOWN, $CLOWN_CURX, $CLOWN_CURY) WEnd Func _IsClicked() if (GUIGetMsg() == $CLOWN) Then GUICtrlSetData($score_lb, "Score: " & $CUR_SCORE) SoundPlay("click.wav", 0) Return True Else Return False EndIf EndFunc Func _CreateTimer($function, $time) AdLibEnable($function, $time*1000) EndFunc Func _DeleteTimer() AdLibDisable() EndFunc Func GameOver() GUICtrlDelete($CLOWN) GUICtrlDelete($score_lb) GUICtrlDelete($time_time) GUICtrlCreateLabel("Game Over!" & @CRLF & "Score: " & $CUR_SCORE, 50, 100, 500, 500) GUICtrlSetFont(-1, 30) GUICtrlSetColor(-1, $COLOR_WHITE) While (GUIGetMsg() <> -3) WEnd _DeleteTimer() Exit EndFunc Func Count() $CUR_TIMELEFT -= 1 GUICtrlSetData($time_time, "Time Remaining: " & $CUR_TIMELEFT & " seconds.") if ($CUR_TIMELEFT <= 0) Then GameOver() EndIf if ($CUR_TIMELEFT < 10) Then GUICtrlSetColor($time_time, 0x00FF00) EndIf if ($CUR_TIMELEFT < 5) Then GUICtrlSetColor($time_time, 0xFF0000) EndIf EndFunc the needed files: Edited September 12, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
RazerM Posted July 13, 2006 Share Posted July 13, 2006 I got 14949. Is that bad? The game isn't bad either My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
cppman Posted July 13, 2006 Author Share Posted July 13, 2006 lol, thanks.. my highscore is 10440(something like that), and thats cuz im used to it, so i guess its pretty good. Miva OS Project Link to comment Share on other sites More sharing options...
gamepin126 Posted July 13, 2006 Share Posted July 13, 2006 (edited) EDIT: Good job. Edited July 13, 2006 by gamepin126 Link to comment Share on other sites More sharing options...
WTS Posted July 13, 2006 Share Posted July 13, 2006 EDIT: Good job.yeah cooli got 15441 Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 17, 2006 Share Posted July 17, 2006 (edited) Hi, I got 962 with a bot Edit: 954 So long, Mega Edited July 17, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Private Posted September 10, 2006 Share Posted September 10, 2006 (edited) Hi, I got 962 with a bot Edit: 954 So long, Mega so lol, i got an error with using my bot : If $msg = $clown then ClownClick() Error: Recursion level has been exceede - Autoit will quit to prevent stack overflow That's because i changed $count to 10000 HotKeySet ("{ESC}","exitps") ProcessWait ("clown.exe") while 1 $coord = PixelSearch( 0, 0, 1280, 1280, 0xFF0000 ) If Not @error Then MouseClick ("Left", $coord[0]+10,$coord[1]+10,1,1) EndIf WEnd func exitps() exit 0 EndFunc credit to the poster of the script p.s. i got 1140 as my score Edited September 10, 2006 by D.Peeters Link to comment Share on other sites More sharing options...
NELyon Posted September 10, 2006 Share Posted September 10, 2006 2030 ...with bot Link to comment Share on other sites More sharing options...
theguy0000 Posted September 10, 2006 Share Posted September 10, 2006 26092.....nice game The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
FuryCell Posted September 11, 2006 Share Posted September 11, 2006 Cool game. Game Over! Your score is: 15329 HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Rallert Posted September 11, 2006 Share Posted September 11, 2006 I got 8997 all by myself... 2nd try Am I good or what?! Nice game btw... But get some other sound! Don't copy sound and picture from game maker... Link to comment Share on other sites More sharing options...
cppman Posted September 12, 2006 Author Share Posted September 12, 2006 wow, this post came back to haunt me ... This game was a bit cheap(i thought), rewrote it with the new collision technique i learned . @Rallert > I used GM's sound and art was because I was trying to replicate it check first post for new code! Miva OS Project Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now