< FIVE MINUTE BASIC #5 - Simple Principle to Avoid Colour Clash
If you're new to the Spectrum or have returned to it after a long time, you may have noticed that when you draw or print with two different colours next to each other, the colour runs into blocks that you don't want it to. If you are used to some of the older drawing packages, on 16 bit machines, you might think that you have left a gap somewhere, perhaps one a couple of pixels wide but - that isn't the problem with drawing on the 8-bit Spectrum.
This is a actually a standard problem on the unmodified ZX Spectrum and apparently some other old computers, but - with careful planning of your PRINT, PLOT, and DRAW statements it is, to some extent, avoidable.
The following program doesn't carry out any major operations that require explaining - it simply demonstrates the problem with drawing in colour (ironically, given the computers name) on the ZX Spectrum machines.
1 REM Demonstration of ZX colour clash
2 REM Stephen Nichol 2014
10 FOR x=2 TO 16 STEP 1
20 PLOT 1,1
30 DRAW INK 5;0,90
40 PLOT x,1
50 PRINT AT 5,1;"X POS: ";x
60 PRINT AT 6,1;"DISTANCE IN PIXELS: ";x-1
70 IF x<7 THEN PRINT FLASH 1;AT 7,1;"COLOUR CLASH!"
80 IF x>=7 THEN PRINT FLASH 0;AT 7,1;"No
Clash."
90 DRAW INK 2;0,90
100 PAUSE 75
110 CLS
120 NEXT x
When you run this program, you will see that - if a distance of a number of pixels is maintained between the two lines, they can be of a different colour. This won't solve every problem with drawing on the ZX machines but, it is certainly a very useful fact to know and a step towards creating better pictures on these sometimes quirky computers.