Udostępnij za pośrednictwem


Coloured Blocks Advancing on a Moving Block

This blog would be titled Space Invaders, but I don't own that trademark so I had to choose something a bit more generic. This is a preliminary post to show a very hacked up version of the popular game in HDi. Note that I hope to follow up with a more complete version at some stage, but people have been asking for this so I am going to post it anyway.

Disclaimer: I hacked this together in a couple of hours after someone asked me if it could be done. It is not very good code, it uses magic numbers, it hasn't been well tested, etc. and is not functionally complete. Nevertheless, you can have some fun with it and maybe use it to build something cooler.

I also won't provide much commentary here, since I hope to do that with a better-written version soon(ish). Having said that, a very quick summary is:

You (the blue box at the bottom) move by hitting left or right on the keyboard / remote. Once moving, you can't stop until you hit the edge or turn around. You fire by hitting enter (or OK on the remote), and you can only have one bullet in the air at any given time (so don't miss :-) ).

You get 100 points for hitting an enemy. Hit them all, and you win (the "you've won!" sequence is so mind-blowingly cool that you have to see it for yourself). If an enemy hits you with a bullet, or if the bottom row of enemies advances into your "home base", you lose. Again, the cinematic for losing is simply breathtaking.

Things you might want to work on:

  • Add animated graphics for you and the enemies. Simple backgroundFrame animation can do this
  • Improve the hit-testing logic (right now, bullets are assumed to be 1-pixel wide)
  • Add the "shields" to the game; I planned for it but haven't done it yet
  • Make enemies score different points when you hit them (based on rank and how far down they are)
  • Have different "skill levels" if you complete one screen
  • Improve the code to be more modular, not query the markup page so much, and not rely on hard-coded numbers (like "485" on line 109!)
  • Improve perf by not doing any per-tick operations if you know nothing needs to be done

Etc.

Anywho, that's it. I'll try to do more later...

[Download the ADV_OBJ as a ZIP file]

Comments

  • Anonymous
    April 03, 2007
    Very cool Peter!! This is amazing.

  • Anonymous
    April 05, 2007
    O_O amazing!

  • Anonymous
    April 24, 2007
    Nice Peter.  Your game is much more compelling than my own.  The death screen is barbaric!

  • Anonymous
    May 12, 2007
    Although I tend to blog about HDi and advanced interactivity in HD DVD, many customers simply want to

  • Anonymous
    May 12, 2007
    Although I tend to blog about HDi and advanced interactivity in HD DVD, many customers simply want to

  • Anonymous
    May 16, 2007
    The comment has been removed

  • Anonymous
    June 01, 2007
    There have been a lot of JavaScript games created for the web. And, because HDi is based on web standards,