lokster Posted July 13, 2007 Share Posted July 13, 2007 (edited) Here it is! A tetris game! Real classic I plan to add save/load game and hi-scores table:)The controls are:{LEFT} - move left{RIGHT} - move right{UP} - rotate{DOWN} - move downscreenshot:source:tetris.au3[autoit]#Region ;**** Directives created by AutoIt3Wrapper_GUI ****#AutoIt3Wrapper_Compression=4#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****#include <GUIConstants.au3>#Include <Misc.au3>Global $GDI32 = DllOpen("gdi32.dll")Global $USER32 = DllOpen("user32.dll")Global Const $screenWidth = 200Global Const $screenHeight = $screenWidth * 2Global Const $fieldWidth = 10Global Const $fieldHeight = 20Global Const $APPTITLE = 'Tetris v0.1'Opt("GUIOnEventMode", 1)#Region ### START Koda GUI section ### Form=D:\lokster\autoit\tetris\Form1.kxfGlobal $Form1 = GUICreate("Tetris by lokster", 308, 416, -1, -1)GUISetOnEvent($GUI_EVENT_CLOSE, "Bye")Global $Display = GUICtrlCreateLabel("", 8, 8, 200, 401, $SS_GRAYFRAME)GUICtrlSetCursor(-1, 0)Global $About = GUICtrlCreateLabel(" Edited July 17, 2007 by lokster Link to comment Share on other sites More sharing options...
AzKay Posted July 13, 2007 Share Posted July 13, 2007 Nice :3 The only problem I can see is, If you cause the game, You can steal play. They just dont drop by themselves. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
lokster Posted July 13, 2007 Author Share Posted July 13, 2007 (edited) Yes. Thanks for noticeing. Will fix it. :Edit Fixed! Edited July 13, 2007 by lokster Link to comment Share on other sites More sharing options...
RazerM Posted July 13, 2007 Share Posted July 13, 2007 I don't really like Tetris but well done 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...
lokster Posted July 13, 2007 Author Share Posted July 13, 2007 Me too don't like tetris I prefer something with a crosshair in the center of the screen, and lots of blood.... But this is an example of working AutoIt game. Someone may find it usefull. Link to comment Share on other sites More sharing options...
Zedna Posted July 13, 2007 Share Posted July 13, 2007 VERY NICE lokster!!! I like your tetris. The only thing I'm missing there is drop object to bottom on {Down} key. I mean to drop it to the ground and not by 1 down. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
lokster Posted July 13, 2007 Author Share Posted July 13, 2007 Will do. In the next release Maybe on monday... Link to comment Share on other sites More sharing options...
AzKay Posted July 13, 2007 Share Posted July 13, 2007 Heres a future idea, The hiscores, Have online hiscores :3 Though, It would be pretty easy to mess around with. Hehe # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
idusy Posted July 13, 2007 Share Posted July 13, 2007 (edited) I almost made this a couple days ago, but I hate Tetris. Looks pretty, way more nice looking then I would have made it Edited July 13, 2007 by idusy Link to comment Share on other sites More sharing options...
idusy Posted July 13, 2007 Share Posted July 13, 2007 There's a glitch. Every once in a while a bunch come out of no where and fall instantly and I lose... Link to comment Share on other sites More sharing options...
gseller Posted July 13, 2007 Share Posted July 13, 2007 Great Job! Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted July 13, 2007 Share Posted July 13, 2007 Excellant job! Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
dandymcgee Posted July 13, 2007 Share Posted July 13, 2007 (edited) It would be even better if you could make it so that if the down key is held when a new piece comes, the new piece will NOT fall fast because i hold the down key to get a piece to fall fast, the game lags, and when the game unlags the next two pieces are at the bottom where i don't want them... also making the screen a bit bigger would be cool.EDIT: spelling Edited July 13, 2007 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
idusy Posted July 13, 2007 Share Posted July 13, 2007 It would be even better if you could make it so that if the down key is held when a new piece comes, the new piece will NOT fall fast because i hold the down key to get a piece to fall fast, the game lags, and when the game unlags the next to pieces are at the bottom where i don't want them... also make the screen a bit bigger would be cool.That too. Link to comment Share on other sites More sharing options...
Achilles Posted July 16, 2007 Share Posted July 16, 2007 WHERE'S THE AWESOME TETRIS MUSIC???????? That would be nice (including the sound effects for a piece falling and a row completed or the ultimate four rows completed!)... Also, in my old tetris game you can see the next piece, that would be a cool addition. I like this game so far! Good job! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
lokster Posted July 16, 2007 Author Share Posted July 16, 2007 UPDATE! Changed the way the keyboard controls are handled. Now they are a little bit more responsive, and there is no lag when pressing {DOWN}. Also added next block preview, and made the game field a little bit larger. And the main window itself is larger now. Still need to add the hi-score table and (eventually) the music If somebody can find me the original music from the tetris game it would be cool. (Preferably as .mid) Bug reports are wellcome Link to comment Share on other sites More sharing options...
dandymcgee Posted July 16, 2007 Share Posted July 16, 2007 (edited) I recommend trying the HotKeySet() function for the up down left and right arrow keys, because I think it will work much smoother and faster. Right now it takes forever to turn a piece, or move a piece... and it's really hard when the screen is about half full of bricks and I don't have time to turn a piece twice before it hits them. The down key doesn't lag it now, but it just seems like the reaction the game has to keys being pressed is way too slow. Other than that, the game so far is looking really great.EDIT: Attempting to use the HotKeySet function now. Read next post. Edited July 16, 2007 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
dandymcgee Posted July 16, 2007 Share Posted July 16, 2007 (edited) Okay at first I didn't think it was going to work... but after a few debugging sessions, this is what I came up with. This seems to be quite a bit smoother and faster than using _IsPressed() and can probably be improved further.. who knows. Let me know what you think. [autoit]#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #Include <Misc.au3> Global $GDI32 = DllOpen("gdi32.dll") Global $USER32 = DllOpen("user32.dll") Global Const $screenWidth = 200 Global Const $screenHeight = $screenWidth * 2 Global Const $fieldWidth = 10 Global Const $fieldHeight = 20 Global Const $APPTITLE = 'Tetris v0.1' Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=D:\lokster\autoit\tetris\Form1.kxf Global $Form1 = GUICreate("Tetris by lokster", 308, 416, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Bye") Global $Display = GUICtrlCreateLabel("", 8, 8, 200, 401, $SS_GRAYFRAME) GUICtrlSetCursor(-1, 0) Global $About = GUICtrlCreateLabel(" Edited July 16, 2007 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
Zedna Posted July 16, 2007 Share Posted July 16, 2007 Super, great progress. One suggestion: Make {Pause} shortuct for Puase button. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
smstroble Posted July 16, 2007 Share Posted July 16, 2007 (edited) WHERE'S THE AWESOME TETRIS MUSIC???????? That would be nice (including the sound effects for a piece falling and a row completed or the ultimate four rows completed!)... Also, in my old tetris game you can see the next piece, that would be a cool addition. I like this game so far! Good job! I did not create this. expandcollapse popup#cs §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Beep Songs by Paulie Parameters: _*Key*($duration) *Key* - # of keyboard key Duration - How long to hold it §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ #ce HotKeySet("{ESC}", "quit") Global $list[100] $list = StringSplit("4186.01|3951.07|"& _ "3729.31|3520.00|3322.44|"& _ "3135.96|2959.96|2793.83|"& _ "2637.02|2489.02|2349.32|"& _ "2217.46|2093.00|1975.53|"& _ "1864.66|1760.00|1661.22|"& _ "1567.98|1479.98|1396.91|"& _ "1318.51|1244.51|1174.66|"& _ "1108.73|1046.50|987.767|"& _ "932.328|880.000|830.609|"& _ "783.991|739.989|698.456|"& _ "659.255|622.254|587.330|"& _ "554.365|523.251|493.883|"& _ "466.164|440.000|415.305|"& _ "391.995|369.994|349.228|"& _ "329.628|311.127|293.665|"& _ "277.183|261.626|246.942|"& _ "233.082|220.000|207.652|"& _ "195.998|184.997|174.614|"& _ "164.814|155.563|146.832|"& _ "138.591|130.813|123.471|"& _ "116.541|110.000|103.826|"& _ "97.9989|92.4986|87.3071|"& _ "82.4069|77.7817|73.4162|"& _ "69.2957|65.4064|61.7354|"& _ "58.2705|55.0000|51.9130|"& _ "48.9995|46.2493|43.6536|"& _ "41.2035|38.8909|36.7081|"& _ "34.6479|32.7032|30.8677|"& _ "29.1353|27.5000|", "|") ;Notes Go Here ;Format - Number of key on the piano (1 lowest-88 highest), Duration to hold While 1 For $a = 1 to 2 _56(400) _51(200) _52(200) _54(200) _56(100) _54(100) _52(200) _51(200) _49(400) _49(200) _52(200) _56(400) _54(200) _52(200) _51(600) _52(200) _54(400) _56(400) _52(400) _49(400) _49(400) _27(200) _28(200) _30(200) _54(400) _57(200) _61(400) _59(200) _57(200) _56(600) _52(200) _56(400) _54(200) _52(200) _51(400) _51(200) _52(200) _54(400) _56(400) _52(400) _49(400) _49(400) _R(400) Next For $b = 1 to 2 _44(200) _44(200) _40(200) _44(200) _42(200) _44(200) _39(200) _44(200) _40(200) _44(200) _37(200) _44(200) _36(200) _44(200) _39(400) Next For $a = 1 to 2 _56(400) _51(200) _52(200) _54(200) _56(100) _54(100) _52(200) _51(200) _49(400) _49(200) _52(200) _56(400) _54(200) _52(200) _51(600) _52(200) _54(400) _56(400) _52(400) _49(400) _49(400) _27(200) _28(200) _30(200) _54(400) _57(200) _61(400) _59(200) _57(200) _56(600) _52(200) _56(400) _54(200) _52(200) _51(400) _51(200) _52(200) _54(400) _56(400) _52(400) _49(400) _49(400) _R(400) Next Wend Func quit() Exit EndFunc ;------------------- Func _R($dura) Sleep($dura) EndFunc Func _88($dura) Beep($list[1], $dura) EndFunc Func _87($dura) Beep($list[2],$dura) EndFunc Func _86($dura) Beep($list[3],$dura) EndFunc Func _85($dura) Beep($list[4],$dura) EndFunc Func _84($dura) Beep($list[5],$dura) EndFunc Func _83($dura) Beep($list[6],$dura) EndFunc Func _82($dura) Beep($list[7],$dura) EndFunc Func _81($dura) Beep($list[8],$dura) EndFunc Func _80($dura) Beep($list[9],$dura) EndFunc Func _79($dura) Beep($list[10],$dura) EndFunc Func _78($dura) Beep($list[11],$dura) EndFunc Func _77($dura) Beep($list[12],$dura) EndFunc Func _76($dura) Beep($list[13],$dura) EndFunc Func _75($dura) Beep($list[14],$dura) EndFunc Func _74($dura) Beep($list[15],$dura) EndFunc Func _73($dura) Beep($list[16],$dura) EndFunc Func _72($dura) Beep($list[17],$dura) EndFunc Func _71($dura) Beep($list[18],$dura) EndFunc Func _70($dura) Beep($list[19],$dura) EndFunc Func _69($dura) Beep($list[20],$dura) EndFunc Func _68($dura) Beep($list[21],$dura) EndFunc Func _67($dura) Beep($list[22],$dura) EndFunc Func _66($dura) Beep($list[23],$dura) EndFunc Func _65($dura) Beep($list[24],$dura) EndFunc Func _64($dura) Beep($list[25],$dura) EndFunc Func _63($dura) Beep($list[26],$dura) EndFunc Func _62($dura) Beep($list[27],$dura) EndFunc Func _61($dura) Beep($list[28],$dura) EndFunc Func _60($dura) Beep($list[29],$dura) EndFunc Func _59($dura) Beep($list[30],$dura) EndFunc Func _58($dura) Beep($list[31],$dura) EndFunc Func _57($dura) Beep($list[32],$dura) EndFunc Func _56($dura) Beep($list[33],$dura) EndFunc Func _55($dura) Beep($list[34],$dura) EndFunc Func _54($dura) Beep($list[35],$dura) EndFunc Func _53($dura) Beep($list[36],$dura) EndFunc Func _52($dura) Beep($list[37],$dura) EndFunc Func _51($dura) Beep($list[38],$dura) EndFunc Func _50($dura) Beep($list[39],$dura) EndFunc Func _49($dura) Beep($list[40],$dura) EndFunc Func _48($dura) Beep($list[41],$dura) EndFunc Func _47($dura) Beep($list[42],$dura) EndFunc Func _46($dura) Beep($list[43],$dura) EndFunc Func _45($dura) Beep($list[44],$dura) EndFunc Func _44($dura) Beep($list[45],$dura) EndFunc Func _43($dura) Beep($list[46],$dura) EndFunc Func _42($dura) Beep($list[47],$dura) EndFunc Func _41($dura) Beep($list[48],$dura) EndFunc Func _40($dura) Beep($list[49],$dura) EndFunc Func _39($dura) Beep($list[50],$dura) EndFunc Func _38($dura) Beep($list[51],$dura) EndFunc Func _37($dura) Beep($list[52],$dura) EndFunc Func _36($dura) Beep($list[53],$dura) EndFunc Func _35($dura) Beep($list[54],$dura) EndFunc Func _34($dura) Beep($list[55],$dura) EndFunc Func _33($dura) Beep($list[56],$dura) EndFunc Func _32($dura) Beep($list[57],$dura) EndFunc Func _31($dura) Beep($list[58],$dura) EndFunc Func _30($dura) Beep($list[59],$dura) EndFunc Func _29($dura) Beep($list[60],$dura) EndFunc Func _28($dura) Beep($list[61],$dura) EndFunc Func _27($dura) Beep($list[62],$dura) EndFunc Func _26($dura) Beep($list[63],$dura) EndFunc Func _25($dura) Beep($list[64],$dura) EndFunc Func _24($dura) Beep($list[65],$dura) EndFunc Func _23($dura) Beep($list[66],$dura) EndFunc Func _22($dura) Beep($list[67],$dura) EndFunc Func _21($dura) Beep($list[68],$dura) EndFunc Func _20($dura) Beep($list[69],$dura) EndFunc Func _19($dura) Beep($list[70],$dura) EndFunc Func _18($dura) Beep($list[71],$dura) EndFunc Func _17($dura) Beep($list[72],$dura) EndFunc Func _16($dura) Beep($list[73],$dura) EndFunc Func _15($dura) Beep($list[74],$dura) EndFunc Func _14($dura) Beep($list[75],$dura) EndFunc Func _13($dura) Beep($list[76],$dura) EndFunc Func _12($dura) Beep($list[77],$dura) EndFunc Func _11($dura) Beep($list[78],$dura) EndFunc Func _10($dura) Beep($list[79],$dura) EndFunc Func _9($dura) Beep($list[80],$dura) EndFunc Func _8($dura) Beep($list[81],$dura) EndFunc Func _7($dura) Beep($list[82],$dura) EndFunc Func _6($dura) Beep($list[83],$dura) EndFunc Func _5($dura) Beep($list[84],$dura) EndFunc Func _4($dura) Beep($list[85],$dura) EndFunc Func _3($dura) Beep($list[86],$dura) EndFunc Func _2($dura) Beep($list[87],$dura) EndFunc Func _1($dura) Beep($list[88],$dura) EndFunc Just run it in the background . Or have the script run it in the back ground but I would still keep it a separate script so that it plays properly. EDIT: AHHHHHHHHHHHHHH! Note beep songs may be VERY loud on laptops... regardless of volume settings.. you have been warned. Edited July 16, 2007 by smstroble MUHAHAHAHAHA 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