256 Colour Tutorial Part 2: Difference between revisions
m
→Changing an individual colour
Line 70: | Line 70: | ||
===Changing an individual colour=== | ===Changing an individual colour=== | ||
Sometimes you may want to change the colour of a particular slot for some reasons, in such case you may check out the function '''SetPalRGB()''' | Sometimes you may want to change the colour of a particular slot for some reasons, in such case you may check out the function '''SetPalRGB()'''. Again, let me just copy something from the AGS manual to bloat this space a bit: | ||
<blockquote> | <blockquote> | ||
'''SetPalRGB'''<br> | '''SetPalRGB'''<br> | ||
Line 80: | Line 80: | ||
</blockquote> | </blockquote> | ||
(By "locked" colours in the last sentence of the description it is actually referring to slots #0 thru #16, which are normally considered to be used by the system engine and are not advised to change.) | (By "locked" colours in the last sentence of the description it is actually referring to slots #0 thru #16, which are normally considered to be used by the system engine and are not advised to change.) | ||
Well, I won't bother explaining the above word by word. Basically what this function does, is to change the colour of a slot directly, ''all'' pixels on screen which use this slot will be changed to the new colour immediately. | |||
Well, I won't bother explaining the above word by word. Basically what this function does, is to change the colour of a slot directly, and ''all'' pixels on screen which use this slot will be changed to the new colour immediately. | |||
Let's illustrate this with an example, remember the [[media:8bittut_ss1.bmp|sprites]] we used in Part 1? Conside the girl sprite: | Let's illustrate this with an example, remember the [[media:8bittut_ss1.bmp|sprites]] we used in Part 1? Conside the girl sprite: | ||
Line 120: | Line 121: | ||
Again, save your script and test the game. Got it already? | Again, save your script and test the game. Got it already? | ||
Above are just some small examples on how to modify individual palette slots using '''SetPalRGB()''' | Above are just some small examples on how to modify individual palette slots using '''SetPalRGB()'''. You may experiment yourself, like changing other slots, changing some of the slots into other crazy colours, etc. You may even think of some colour animations, with colour changes decided by some mathematical formulae. Everything is left to your imaginations. But always bear in mind that whenever you use '''SetPalRGB()''', the r-, g-, b- channel values ''must'' be within the allowed range of 0 through 63. | ||
===Conclusion=== | ===Conclusion=== |