
I was finishing up some tedious work around midnight a few days ago and decided I needed to code something fun. I have a few projects I’m already working on so I figured I’d do something small and quick. Lately I’ve been getting interested in game programming so I wanted to do something along those lines. “But what sort of game can I make in a few hours?” I thought to myself. Then it hit me. I was going to make Tetris.
I’d never made anything like this before so I decided to implement in JavaScript since I’ve been doing a lot of JavaScript coding lately. I grabbed a Coke from the fridge and got to work. It took a couple of hours to throw together the internals and another hour or so to style it (CSS is not my cup of tee). I used the sweet jQuery library for all DOM manipulation and a few images I made so the blocks would look nice. It turned out pretty well and after one long night I had a nice little tetris game!
It works in Safari 3, Firefox 2, IE 6 & 7, and Opera 9 (those are all the browsers I have installed) with the only caveat being that Opera doesn’t continuously fire the onkeydown event while a button is pressed, so dropping blocks quickly in Opera requires multiple taps on the down arrow.
The code, styles, images, and markup are available here in case anyone wants to fix any bugs they find or use it as a studying tool (the code is commented, but it was late so the comments are not as detailed as they could be).
Well enough talk! Check it out!
jScrollHorizontalPane is a plugin based off of Kevin Luck’s jScrollPane which override’s the browsers…
I was finishing up some tedious work around midnight a few days ago and decided I needed to code something fun. I have…
For the new threeformed site I am using WordPress as a light CMS, so I wanted to treat some ‘special’ posts d…
This is a simple jQuery plugin used to create a horizontal or vertical clicking scroll menu. It’s lightweight, s…
This is the home of the GrooveControl Firefox 4 plugin.
I really like tetris, I waiste all of my time at work playing it.
Awesome! … just what I needed to pass some time!
It’s been a long time since I’ve played Tetris. Thanks for getting me off of twitter for an hour.