256 Colour Tutorial Part 2(V2.62): Difference between revisions

m
Line 77: Line 77:
Let's illustrate this with an example, remember the [[media:8bittut_ss1.pcx|sprites]] we used in the part 1? Conside the girl sprite:
Let's illustrate this with an example, remember the [[media:8bittut_ss1.pcx|sprites]] we used in the part 1? Conside the girl sprite:


[[Image:8bittut_sprite0.png]]
[[Image:8bittut_sprite0.png|center|68px|Girl sprite]]


If you check, you'll see that the red tips of her antennae were drawn using colour slot #32. Suppose you want them to alter between black and red colours endlessly throughout the ''whole game'', what we can do is, in each game loop, if the colour of slot #32 is currently <font color='FF0000'>red</font> change it to <font color='000000'>black</font> (where (r, g, b) tuple equals (0, 0, 0) ) , ''else'' change it to <font color='FF0000'>red</font> (where (r, g, b) tuple equals (63, 0, 0) ). This logic can be visualised as follow:
If you check, you'll see that the red tips of her antennae were drawn using colour slot #32. Suppose you want them to alter between black and red colours endlessly throughout the ''whole game'', what we can do is, in each game loop, if the colour of slot #32 is currently <font color='FF0000'>red</font> change it to <font color='000000'>black</font> (where (r, g, b) tuple equals (0, 0, 0) ) , ''else'' change it to <font color='FF0000'>red</font> (where (r, g, b) tuple equals (63, 0, 0) ). This logic can be visualised as follow: