256 Colour Tutorial Part 1: Difference between revisions

m
Line 81: Line 81:
[[Image:8bittut_dizzypal.png|center|Dizzy bg palette]]
[[Image:8bittut_dizzypal.png|center|Dizzy bg palette]]


Note that when I make a background I just save a sprite image ''as a different name'' (so it has all the sprite colours properly set), ''change its size'' to the background size I need, ''clear'' it, and then start adding colours from ''the end'' of the palette, as they're supposed to be "'''room dependent'''", so you can paint your backgrounds with these slots and make them different in different backgrounds if necessary. Note also that the first half of the palette matches that of the sprites so I can still use these fixed colours in my backgrounds if necessary (just don't change their colours as you may have drawn some of the sprites with these slots already).
Note that when I make a background I just save a sprite image ''with a different name'' (so it has all the sprite colours properly set), ''change its size'' to the background size I need, ''clear'' it, and then start adding colours from ''the end'' of the palette, as they're supposed to be "'''room dependent'''", so you can paint your backgrounds with these slots and make them different in different backgrounds if necessary. Note also that the first half of the palette matches that of the sprites so I can still use these fixed colours in my backgrounds if necessary (just don't change their colours as you may have drawn some of the sprites with these slots already).
Now you may try importing it as a room background. My test game used 320x240 as its default resolution, so the background is of this dimension. Before actually importing any background into a room, go to "'''File --> Preferences...'''" and make sure that "'''Remap palette of room backgrounds into allocated background palette slots (8-bit only)'''" checkbox under the '''8-bit background import''' section is ''un''checked'', like this:
Now you may try importing it as a room background. My test game used 320x240 as its default resolution, so the background is of this dimension. Before actually importing any background into a room, go to "'''File --> Preferences...'''" and make sure that "'''Remap palette of room backgrounds into allocated background palette slots (8-bit games only)'''" box under the '''8-bit background import''' section is ''un''checked, like this:


[[Image:8bittut_imbg00_v3.png|center|Exact palette import background settings]]
[[Image:8bittut_imbg00_v3.png|center|Exact palette import background settings]]


This is to ensure that the backgrounds will be imported in an unaltered stage, without the colours of it being rudely moved around by the editor (similar to the sprites). 'This is very important!'  
This is to ensure that the backgrounds will be imported in an unaltered stage, without the colours of it being rudely moved around by the editor (similar to the sprites). '''This is very important!'''
Now, add a new room (or, if you're using the default game template, just edit ''Room 1''), make sure that ''Background to display'' is set to ''Main background'', click the '''Change...''' button on the right and then select the background image file. The background should be imported without any problem.
Now, add a new room (or, if you're using the default game template, just edit ''Room 1''), make sure that ''Background to display'' is set to ''Main background'', click the '''Change...''' button on the right and then select the background image file. The background should be imported without any problem.


Line 100: Line 100:


Obviously the colours assigned for this background are different from the last one, that's how "'''background'''" slots work.
Obviously the colours assigned for this background are different from the last one, that's how "'''background'''" slots work.
If you had examined the image, you may have noted that I used also colour slot #0 in it, which was set to pink by me, I just use it for some reasons and it's not important here, and always remember after import it will ''always'' become black.
If you examine the image, you may have noted that I used also colour slot #0 in it, which was set to pink by me. I just use it for some reasons and it's not important here, and remember that after import it will ''always'' become black.
I can now import the background with exact palette blah bla... (like before) as the background of another room.
I can now import the background with exact palette blah bla... (like before) as the background of another room.


Next, I think it may be a good idea to add a door to the disco room, so I want to draw a sprite for it, but I want it to blend with the background perfectly, and since that sprite will only be used in one room, it doesn't seem like a good idea to waste "'''fixed'''" sprite colour slots by copying some of the colours from the background. What should I do? I just draw [[media:8bittut_door.bmp|this]], which uses the "'''background'''" colour slots directly. You may have asked, "aren't these slots available '''ONLY''' for backgrounds?" The answer is, "Yes, and No. These slots can be used for backgrounds, but you ''can'' actually use them in sprites too, provided that each of these sprite is ''only'' used in ''one particular'' room or other rooms ''using similar colour settings'', otherwise it may look funny."
Next, I think it may be a good idea to add a door to the disco room, so I want to draw a sprite for it, but I want it to blend with the background perfectly, and since that sprite will only be used in one room, it doesn't seem like a good idea to waste "'''fixed'''" sprite colour slots by duplicating some of the colours from the background. What should I do? I just draw [[media:8bittut_door.bmp|this]], which uses the "'''background'''" colour slots directly. You may have asked, "aren't these slots available '''ONLY''' for backgrounds?" The answer is, "Yes, and No." These slots can be used for backgrounds, but you ''can'' actually use them in sprites too, provided that each of these sprite is ''only'' used in ''one particular'' room or other rooms ''using similar colour settings'', otherwise it may look funny.


To import this door sprite, go to "'''Sprites'''" and open up the import dialog, make sure you have ''un''checked "'''Remap colours to game palette'''" and select "'''Palette index 0'''" as the transparent colour, ''AND'' '''check''' the "'''Lock to room background palette''" box. You can then import the sprite like before.
To import this door sprite, go to "'''Sprites'''" and open up the import dialog, make sure you have ''un''checked "'''Remap colours to game palette'''" and select "'''Palette index 0'''" as the transparent colour, ''AND'' '''check''' the "'''Lock to room background palette'''" box. You can then import the sprite like before.


If you place the sprite as an object in the room you'll find out whether it's imported properly (if you try putting it in the "dizzy" room, you may find it looking funny, since the two room backgrounds use different colours; note also that currently it seems that the sprite's colour may be messed up when you first place it onto the room in the editor, but if you test 5the game or restart the editor the problem seems to have gone):
If you place the sprite as an object in the room you'll find out whether it's imported properly (if you try putting it in the "dizzy" room, you may find it looking funny, since the two room backgrounds use different colours; note also that currently it seems that the sprite's colour may be messed up when you first place it onto the room in the editor, but if you test the game or restart the editor the problem seems to have gone):


[[Image:8bittut_discogam_v3.png|center|Disco room screenshot]]
[[Image:8bittut_discogam_v3.png|center|Disco room screenshot]]


Note that I also place [[Roger]] in the room for comparison, and he looks ''real'' funny, like a zombie, that's because I changed the colours of slots #17 through #41 when I first set up the palette, so if you want to keep CJ's original roger and GUI, etc. sprites intact you shouldn't change them.
Note that I also place [[Roger]] in the room for comparison, and he looks ''real'' funny, like a zombie, that's because I changed the colours of slots #17 through #41 when I first set up the palette, so if you want to keep CJ's original Roger and GUI, etc. sprites intact you shouldn't change them.


===Conclusion===
===Conclusion===