RSS Invaders :: shoot feeds
RSS Invaders :: shoot feeds

UPDATE 2009-05-23 09:07

I just couldn’t leave well enough alone, now could I? RSS Invaders v 0.2.1 adds music, improves collision detection a little, and should have improved performance by a lot, although to be honest I’m not seeing it.  I don’t know if that’s a side effect of the flash being present to stream the mp3, or what. Other improvements include score – smaller words get a bigger score as calculated by (20 – (word length)); text does not highlight due to mouse interaction anymore – that was annoying.

————–

UPDATE 2009-05-22 20:24

RSS Invaders v 0.2 is up. I added the collision detection.  It’s buggy, but works fairly well.  Mostly, I need to work on performance-related issues, which are always going to be a problem since JavaScript is interpreted on the fly, and not compiled into the efficient machine code that computers adore. I also, in researching collision detection, came across what I think is going to become the foundation of future RSS Invaders versions: gameQuery!  gameQuery provides many nice functions which would make javascript game programming much more succint and reliable.  For this project, I wanted to roll my own just to see if I could.  I’m happy with the results.

————–

This first script is old-school meets older-school meets new-school: RSS Invaders v 0.1

It’s an emulation of the famous game, Space Invaders, with a Web 2.0 twist in that it dynamically fetches a feed from Steve Ersinghaus’ stories category and pulls the excerpt in as the invading force! Not all features have been implemented.  I didn’t get to collision detection, so the missiles don’t kill anything, but I had to cut myself off somewhere.

The fact that it emulated this old game makes it old school.  The fact that it goes a step further and uses ASCII characters to depict the whole thing makes it older-school (or geek-school), and the AJAX bit is the new-school.

Don’t expect stuff like this for my future scripts.  I want to try to do something ‘big’ like this every week or two, but in general, my experiments need to be more limited in scope and functionality because this took me 4 hours to program and debug. Still, when you think about how the original programmers of Space Invaders probably toiled over the program for months, if not years, 4 hours is pretty decent, and it’s a tribute to how far these coding libraries have come.

I’m going to attempt to translate my JavaScript code into pseudo-code for you.  This means you should be able to read and understand it without knowledge of programming, and get an idea for program structure.

when the page is ready {

    welcome the user

    load the board
    animate the board
    append the following to the board:
        status bar and title
        invaders container
        ship

    get data from steve's site. when we got that data {
        add the description to the invaders container
        use the title and url to build a link to give credit at the bottom
    }

    start moving the invaders {
        to the right once per second

        if the invaders have gone past the right edge of the board {
            move them down and reverse their direction
        }

        if the invaders strike the ship {
            GAME OVER!
        }
    }

    start moving the ship along with the mouse, but {
        make sure it doesn't move too far to the left or right
    }

    if the mouse is clicked {
        create a missile right where the ship is
        animate it upward until it is off screen
    }

}

Here’s the actual code that’s doing it all: rss-invaders.js

I plan to get the collision detection going, as well as a soundtrack (JOHN! hint hint) and a few other bells and whistles in v 0.2.  None of this stuff can be reproduced without permission.  That’s my license and I’m sticking to it until I figure out a more elegant way to license it.

3 Responses

  1. Thanks Jim, That was some old-school gaming…shooting down Steve’s words was a little strange. I won!

Leave a Reply

Your email address will not be published. Required fields are marked *