It is currently Fri Jun 23, 2017 11:53 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Chr files
PostPosted: Wed Sep 21, 2016 3:30 am 
Offline

Joined: Mon Sep 12, 2016 7:41 pm
Posts: 33
I was playing around with the sprite sizes and wanted to go from, 8x8 to 16 x 8. Now I am wondering how the Chr files work. After changing to 16x8, the top tile appears correct, but the bottom tile is just something random? So i'm wondering, should one rearrange the tiles in the CHR file a certain way? not exactly sure how the second tile of a 16x8 is determined.

Edit: it seems the bottom tile in a 8x16 sprite is the tile to the right of the top tile in the Chr file?


Top
 Profile  
 
 Post subject: Re: Chr files
PostPosted: Wed Sep 21, 2016 4:14 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 998
There are two sets of 256 tiles. One is usually used for the background, one is usually used for sprites.

Because there are 256 tiles in each set, and the range of a byte is 256, in 8x8 mode the byte written to the tile number is the tile used for the sprite in the set selected for sprites.

In 8x16 mode, things are a little different. All even tiles are the top tile, all odd tiles are the bottom tile. You cannot have an odd tile as the top tile. Since every two tiles are now paired, this would mean you only get 128 different choices in the 256 tile "sprite set". And so, you can use tiles from the background set for sprites as well.

Suppose the sprite set is set zero, the background set is set one.

A tile number of 0 specifies you want tile 0 and 1 of the sprite set. A tile number of 1 specifies you want tile 0 and 1 of the background set.

Basically whether the tile number is even or odd now selects whether you use the background of the sprite set. If the tile number given is odd, one is subtracted. If the tile number given is even, it's used.

The result of this potential subtraction is the tile number that will be used for the top tile in the given set. The one to the right of it in the same set is the bottom tile.


Top
 Profile  
 
 Post subject: Re: Chr files
PostPosted: Wed Sep 21, 2016 9:51 pm 
Offline
User avatar

Joined: Sat Mar 30, 2013 12:24 am
Posts: 225
I explained it with some image references here: http://www.mteegfx.com/post/12167953203 ... s-overview

It helps to use yychr for managing your chr files because it can reorganize the way it displays the chr file for 8x16.

_________________
www.mteegfx.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: launchpad and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group