Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision |
programming:c:huc:tips [2020/08/15 02:13] – created cabbage | programming:c:huc:tips [2020/08/15 02:15] (current) – cabbage |
---|
===== BAT Collision ===== | ===== BAT Collision ===== |
HuC's map_get_tile() seems maybe broken, but you can use vram[] instead. | HuC's ''map_get_tile()'' function seems broken, but you can use ''vram[]'' instead. |
| |
e.g., ''tile = vram[y * BAT_width + x] & 0x0FFF;'' | e.g., ''tile = vram[y * BAT_width + x] & 0x0FFF;'' |
| |
The above code would get the tile at ''x,y'' (8x8 tile coordinates). ''BAT_width'' is the width of the virtual screen (32, 64, 128). The ''& 0x0FFF'' part strips out the palette data so you are left with just the tile number. | The above code would get the tile at ''x,y'' (8x8 tile coordinates). ''BAT_width'' is the width of the virtual screen (32, 64, 128). The ''& 0x0FFF'' part strips out the palette data so you are left with just the tile number. |