Once water floods the tunnel, however, the dry colors peel off and reveal the wet colors underneath. How exactly is this effect accomplished? The answer is sprites! Lots and lots of sprites! The tunnel background is an object!
Remember how I said the door object is the mastermind, and implied that it's part of the stage's object layout? I lied. It's actually the tunnel background object which is placed in the layout, and it spawns the door as a helper object, with both objects monitoring the level trigger array.
The fact that it's an object brings us to our first oversight: the object is created with an absurdly low priority value, which causes it to be rendered in front of nearly all other sprites. This is probably so the trailing wave will cover objects placed in the tunnel, but has the unfortunate side effect of also obscuring the objects with the background brick pattern.
Next, let's talk about mapping frames. When the tunnel object spawns, it uses the third frame seen above, switching to the fourth frame when the level trigger array is first set, before looping between the first and second frames.
In order to reduce the total sprite count, the trailing wave is actually baked into the brick pattern, which tiles horizontally every 32 pixels. Then, to minimize VRAM usage, only two variations of the wave graphics are included, 16 pixels apart. As a result, the wave can only lurch forward in increments of 16 pixels, but by switching back to the first mapping frame and simultaneously shifting the object by 32 pixels, the wave can move forward indefinitely using those two frames.
In practice, the tunnel object only animates every other frame, so the wave's movement is limited to only 30 frames per second. However, thanks to the button object, the level's rotating palette is currently animating at a blistering 60 frames per second, which helps mask the jittery movement.
Oh, but it's not over yet. The tunnel object has a shadow baked into its brick pattern, but at one point, the actual tunnel extends upward, which changes the height at which the shadow should be displayed!
The solution is to shift the tunnel object upward once it reaches a certain position, and then pull it back horizontally a bit to account for the diagonal slant of the trailing wave. And if that sounds at all plausible, then get this: the brick pattern is designed in a way that doing so maintains the relative position of every brick.
Unfortunately, this achievement is marred by a stupid oversight. Notice how in the screenshots above, the trailing wave is in the same exact position, but the brick pattern has moved. When the tunnel object gets pulled back, it's pulled back too far, causing the wave to stay in the same spot for four consecutive frames, and throwing the animation out of phase with the movement.
Once this happens, the tunnel object's brick pattern becomes irreparably misaligned with the actual tunnel background.
No comments:
Post a Comment