|
I used it. It's not as fast an approach as it sounds; you want to do hitbox collision first. But if there's a better way to really do pixel-perfect collision, I couldn't figure it out - maybe subdividing hitboxes would have been, but how does that work when the sprites change? I always thought of plain old hitboxes as being unnecessarily cruel - the player can't see them - but if you were on the NES, you probably wouldn't have CPU time for much of anything better. Fortunately, I was on something less basic. Unfortunately, I was working on a bitplane mode (for my sins); the CPU didn't have a barrel shifter (so, for speed, one needed to store pre-shifted copies of sprites and masks); and, because the assembly instruction of course wants to modify the output, I ended up copying the dest mask and doing the source as self-modifying code with chains of unrolled andi.l #<character mask>,-(a0) / bne.w pairs; if the chain falls through, the player's just scraped by a mob. This was of course back in the day that one didn't have to worry about pipeline or cache invalidation, because one simply didn't have the luxury of such things. The naïve loop/temp register implementation would be faster now (and, thanks to µcode and register renaming, would be what the CPU really does inside anyway). Incidentally, you want to really look out for your animation code in games like this, because it impacts directly on game logic. Anything that might reset the animation counters will have side effects. I'm not sure if it was intended that Tiki - despite being a flightless kiwi - from Taito's The NewZealand Story actually can fly with repeated pushes of up mid-jump, for example (although the presence of secret level design elements catering for it suggests it may be, and could actually be a huge easter egg considering it wasn't documented!). Similarly, Turrican II has a trick involving what happens if you fire and let off a smart bomb (space) at the same time while jumping, and then jump again - and I don't know if that's intended, but there's at least a couple of platforms with some nice goodies I don't think you can get to any other way. |