256 Colour Tutorial Part 2(V2.62): Difference between revisions
256 Colour Tutorial Part 2(V2.62) (view source)
Revision as of 11:08, 7 December 2005
, 7 December 2005→Palette cycling
Line 40: | Line 40: | ||
Whenever the function CyclePalette(240, 253) is executed, the colours in these slots are shifted to the left by one slot, and the original colour in the first slot (#240) will be warped to the last slot (#253). | Whenever the function CyclePalette(240, 253) is executed, the colours in these slots are shifted to the left by one slot, and the original colour in the first slot (#240) will be warped to the last slot (#253). | ||
Now, let's decide where to put this code in, for example, I want it to happen whenever I press the Space Bar, so I type this into the room script: | Now, let's decide where to put this code in, for example, I want it to happen whenever I press the '''Space Bar''', so I type this into the room script: | ||
function on_key_press(int key) { | function on_key_press(int key) { | ||
if (key==' ') CyclePalette(240, 253); | if (key==' ') CyclePalette(240, 253); |