Using 7x7x16 tricks -- A practical working example

Written by Kiyotewolf)

With a concise explanation of how the inner workings should act, I thought I should slap together a quick and simple example of the kinds of special effects you can accomplish with these techniques.

When you use this in your programs, you have a few options. You can make the backgrounds independent of the sprites, or you can make your background dramatically affect your sprites when they stand//pass over them.

Sample game idea, Pack-Mann (clone), but with deadly traps. A forcefield//heated floor//lifezapping-tiles.. part of the maze.

If you set your colors on the one direction to be shades of a certain color, and carry the shades across, your sprite will take on a set of colored hues, as if a gel color filter was placed over your character.

In my example, I took the shortest and quickest way to get the colors to stand out when they overlap, without having to calculate an actual mixing of the colors. I simply did a color fill routine, and then shuffled the colors around randomly, so that the colors in the sprite when filtered would take on a radical change when over one another.

Another good idea for this technique, might be after the activation of an alarm, the level changes from being lit in normal lights, to emergency lights only, and all the action becomes hued in your particular choice of color.

I chose red.

DEFINT A-Z SCREEN 13 RANDOMIZE TIMER REDIM Reds(15) FOR Z = 0 TO 15 Reds(Z) = Z * 4 + 3 NEXT Z FOR Z = 0 TO 15 SWAP Reds(INT(RND(1) * 16)), Reds(INT(RND(1) * 16)) NEXT Z FOR x = 1 TO 15 FOR y = 1 TO 15 PALETTE x + y * 16, Reds(x) NEXT y PALETTE x * 16, Reds(x) NEXT x DATA "000FF000" DATA "000EE000" DATA "000E0000" DATA "0BAAAB00" DATA "B0AAA0B0" DATA "00A0A000" DATA "00404000" DATA "44404440" RESTORE FOR y = 1 TO 8 READ Sprite$ FOR x = 1 TO 8 Pixel = VAL("&H" + MID$(Sprite$, x, 1)) PSET (x, y), Pixel NEXT x NEXT y REDIM RRam(8, 8) GET (1, 1)-(8, 8), RRam PUT (1, 1), RRam LINE (0, 10)-(30, 40), 16, BF SprX = 50 SprY = 20 Once = 0 DO key$ = INKEY$ IF key$ <> "" THEN IF LEN(key$) > 1 THEN SELECT CASE RIGHT$(key$, 1) CASE CHR$(&H4B) SprX = SprX - 2 CASE CHR$(&H4D) SprX = SprX + 2 END SELECT END IF END IF IF SprX < 0 THEN SprX = 0 IF SprX > (320 - 8) THEN SprX = (320 - 8) PUT (SprX, SprY), RRam, XOR t! = TIMER: WHILE TIMER - t! < .1: WEND PUT (SprX, SprY), RRam, XOR IF Once = 0 THEN LINE (0, 10)-(30, 40), INT(RND(1) * 15) * 16 + 16, BF t2! = TIMER Once = -1 ELSEIF (TIMER - t2!) > 2 THEN LINE (0, 10)-(30, 40), INT(RND(1) * 15) * 16 + 16, BF t2! = TIMER LOCATE 22, 1 cnt = cnt + 1 PRINT cnt; END IF LOOP

The code is a simple demo, but the effect is quite dramatic.

I know, alot of you are probably saying, "" I couldn't handle dropping from 256 colors down to only 16,... or even worse.. 7!! colors???!

Don't worry, I am going to cover the managing that issue in another submission.

It cycles between colors, so you could make a changing block of red zone. This is of course, overkill, because I could single it down to a single color on the left, as long as the colors which I shuffled are distributed across the rest of the palette in one horizontal shift, covering the intersection points.

What that means, is you can use the MSB color spots to create multiple zone colors, which ALL affect the player in that same manner. You can change the color of the MSB zone palette index individually, at different rates, to make the zones stand out even more. And if you do that, your character will have a kind of halo effect around them when they step in it if you are cycling the zone color. The character will have static color shifts but the rest of the zone pad around them will pulse with the speed you are cycling the zone index color with.

If anybody has further questions about this technique, please put a post in the forum and I will try to respond asap.

There is not a whole lot more about this topic to write about, except for stretching your 16 colors back into a simulated larger color palette, using dithering techniques I originally made for EGA.

Dithering colors in VGA (MCGA 320x200), is rough and is not very pleasing to look at, so I recommend is setting your master palette of either 7 or 15 colors to something that will stand out.

Remember, Gameboy games used to only use 4 shades of gray, which was really, white, black and two shades of gray, and they still had awesome gameplay. Get creative and figure out colors you can re-use and mix around to see what kind of cool signature scheme you can create.

Kiyotewolf!