Saturday, September 22, 2007

Flash 9 Dance Dance Revolution

Very simple rhythm game written with help of my existing gemini lib for AS3. Game itself is 270 lines of code, including MXML. This doesn't include the libraries, but the two new classes RhythmTimeline and RhythmKeyframe are only a couple lines each on top of the existing timeline stuff.

Each keyframe has a 'radius', the distance at which a hit is viable. When a key is pressed, I dig through the behind and ahead heaps up to a given max distance (the maximum radius that you use is a good value), to build a list of possibly 'current' ones, and then I go over this list testing absolute distance versus radius to get a final list.

Most of the speed problems are due to the movement of the sprites (and the fact that I'm creating all the sprites ahead of time and not as needed - easy to fix). I really need to steal/write a good parallax scroller to do this for reals. I found when I added a clipping mask to the keyframes I lost like 20x more speed, so I left it out for now.

There are some small issues regarding visual position not syncing perfectly with the audio (it actually IS synced, but the write and flush delays are hurting it), so sometimes it may feel like you're being gypped. Also this song is probably not the best choice is it actually seems to drift in parts (the latter half of the song is almost perfectly mapped).

You can drag to scroll around the music, and hit the "a" and "q" keys on your keyboard to dance with intensity. You may need to click in the browser (anywhere) to get the keys to recognize (I know how to fix this).

Be patient if you have a slow connection, song is just under 3mb and I didn't make a loader.

Enjoy!

Silver Screen Dance

2 comments:

Unknown said...

Neat, seems a little choppy intermittently, though it could be my machine, are you caching the graphics as bitmaps and that might cause the GarbageCollection to introduce stutters.

I've wanted to build a DDR game for a bit, but using another timeline AS3 library I'm building, called Score.

So have you combined Papervision and the DDR yet? :)

Anonymous said...

Thats so awesome! :D I'd like to make one to!
Could you possibly show the actionscript for the game?