Little Man Progress
Okay, I have gone ahead and sculpted a simple set of platforms by hand. Ultimately I need to make myself a level editor tool to generate all the data for the level graphics. I also toned down the brightness of the PF colors so the player sprite isn't so washed out particulary on top of the blue ladders. I have attached a screenshot, the current code, and the bin all gzipped (Can be opened with Winzip).I did some tricks in the kernel to get it to work. The key thing is that I used what I call the Masked Draw technique. With masked drawing to draw a sprite you do this:
LDA (spritePtr),YAND (maskPtr),YSTA GRPx
Load the sprite graphics, then logically AND with a bit mask. The bit mask is zero for all lines where the sprie must not appear. Yes, that does mean a large table of mostly zeros in ROM, but it can draw a sprite in 13 cycles!Since the player sprite in little man is 5 pixels wide, I have 3 pixels free in the sprite mask table to use for missle rendering control. Like this:
LDA (Mxptr),YSTA ENAMx
Mxptr points into the same masking array in ROM we used for the player sprite. if bit 1 in the mask byte read from the table is set, then the missle is turned on for that line. So the missle is enabled/disabled on the correct line for just 8 cycles time. NOTE: In the attached code the Missle rendering code is turned off at this time. The appearance and dissappearance of sections of the gameboard, including gold that is picked up, is going to be done with a bitmask stored in RAM. The level PF data is stored in ROM. In the ROM image all the necessary elements are present. We can only subtract from the playfield displayed to the player, we can not add to it on the fly. Every write of PF data from ROM is bitwise AND'ed with a byte from the RAM masking table. The masking table has up to 16 entries so we can create up to 16 horizontal bands on the screen where PF pixels are made to appear and vanish as needed. Every time the player picks up some gold a mask modifier script is executed to update mask and hence the playfield appearance. Elevators and such are dynamically altered entries in the masking table. There is going to be some fun coding to get them to work smoothly. End Transmission!
8 Comments
Recommended Comments