Saturday, August 6, 2011

Crows and vultures, oh my !

Over the past couple of days, I've been laboring over the convoluted, spaghetti-like code responsible for the behavior of the "crows" (on the 2nd board with the chains, keys, and birds -- hereafter "chains"), and the "vultures" (on the 3rd board with the moving platforms, ropes, and egg-laying birds -- hereafter "eggs"), both of which share large portions of code.

Now, it's hardly worth mentioning, but this essentially was derived from the code to handle the "springs" in DK (are there any standard names for all these crazy objects/boards?). The only thing that seems to be retained is the bouncy movement of objects as they make their way onto the screen, although even this motion has been altered to accommodate the quirky, skipping entry of each bird before it's inevitable divebomb off the top platform.

What can I say about this code? Hmm.

Well, after a bird takes its initial plunge, the point at which it decides to swoop to the left is illustrated in the image above, and is internally based on the bird's record number (there are 5 total on the "eggs" stage, and 6, 8 or 10 for the "chains" board, depending on the level).

What might actually be of interest is that the 2nd to last bird introduced has a couple of special behaviors. First of all, on the "eggs" stage, it's one of two egg-droppers (the other being the 4th from last). Even so, this egg dropping behavior can be canceled completely if the player reaches a high enough point on the screen (see above image). Try climbing the chains to the far right above the top platform, and egg production will cease entirely, even if you make your way back down the board!

Secondly, it will always choose the lowest point (see above image) to come out of its initial dive and head to the left, unless it's roughly level with the player, in which case it will immediately go left (even if the player is to the right). On the "eggs" board, you can confirm this rogue behavior if the bird drops an egg at any other level above its usual "lowest point".

One last thing to note is that on the "chains" board, the birds will, upon reaching the right edge of the screen (not during its first-time plunge), dive further down once you pass the first level (i.e., the 2nd time you play the board), which explains why the crows are eventually able to reach you in your "safety zone", standing on the bottom platform.

No comments:

Post a Comment