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

m
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);