Hi All!
When it comes to move the character left and right, is it better to rotate each 8x8 tile with code? or is it better to have this as a animation and you just update the tiles information based on pre-set data?
I am starting to learn how to move the character in the screen
I assume it's a top down game, because if it was a side scroller you wouldn't rotate it, you'd flip it, which is simple.
No, generally you don't rotate tiles by code, you have each version ready as data or chr.
No matter whether the graphics are in top-down view or in side view, usually the left and right views are made so that one is the horizontal flip of eachother. Note that it's a flip, NOT a rotation. Using a separate animation is extremely wasteful of your 256 precious sprite tiles. If you need some suble difference (for example the hero holding the weapon in the correct hand), then you can draw only the tiles where this change is significant twice in memory, and the rest once. Even then, 90+% of games didn't care and made those details incoherant - that is the hero would change hands when changing sides.
When we talk about character flipping, there are 2 things to consider: the tiles graphics themselves, which you may or may not need to draw multiple versions of depending on the symmetry of your characters and whether the correct representation of asymmetry is important to you, and the metasprite definitions, which can be flipped on the fly by the engine or manually mirrored in the ROM beforehand, occupying twice the space. I personally prefer to implement dynamic flipping in my metasprite engines, but I've heard of duplicated definitions in ROM before, which is fine if you have the ROM space to spare and would rather have a simpler/faster metasprite engine.
So, the difference between a routine that draws horizontally flipped metasprites vs. regular metasprites:
1. Add 8 to the base X location.* (Only need to do this once for the whole metasprite.)
2. SEC+SBC instead of CLC+ADC to position the X coordinate for each tile.
3. XOR with the attribute byte to set the flip bit. (+2 cycles per tile)
This is a very small change in efficiency, IMO. Actually that step 3 can be used to do other things (palette reassignment, etc.) so the XOR of the attribute byte is something I might do in the unflipped sprite routine too, which makes them essentially equivalent in speed.
Having two metasprite routines costs maybe 50 extra bytes or so. That can very quickly be overcome by the savings from metasprites you don't have to have duplicate left/right versions for.
Just having extra metasprites is a valid approach too, though. Less code, more data. Can be quite appropriate if you have the space.
* This assumes the 0,0 coordinate ("pivot point") of your metasprite is in the horizontal centre of the character. The +8 is to account for the width of a single tile, which when flipped should shift by 8 pixels to remain the same distance from the centre point. If your metasprites put 0,0 somewhere else, e.g. the top left corner, you might need a different offset than +8 for each character to keep them appropriately centred. Keeping the pivot in the middle makes this simpler.
Just in case it wasn't clear: That x-flip thing is a hardware fearure, you do only need to set a bit in the sprite attributes, and the hardware will automatically apply horizontal mirroring to each 8 pixels.
One major issue would be sprites with light/shadow on left/right sides, in that case you may need to use separate sprites instead of mirroring.
RPGs like DQ don't need to use so many sprites so they usually don't mind having separate facing sprites for left and right facing. But action games generally uses more sprites and usually use the hardware flip. Link suddenly becomes right-handed whenever he faces right.
Character rotation would probably be wasteful unless CHR-RAM is used. But most games uses CHR-ROM.
Pokun wrote:
RPGs like DQ don't need to use so many sprites so they usually don't mind having
mcdvoice separate facing sprites for left and right facing. But action games generally uses more sprites and usually use the hardware flip. Link suddenly becomes right-handed whenever he faces right.
Character rotation would probably be wasteful unless CHR-RAM is used. But most games uses CHR-ROM.
yeah thats right
gandrew wrote:
Pokun wrote:
...But most games uses CHR-ROM.
yeah thats right
yeah...?
That's probably a spammer.
Also the OP might be a spammer too, and made a random sentence from often-used words in this forum. Or maybe not. That's though to say.
I guess so, too. This whole thread is dubious (as far as I remeber there was also a now deleted post saying "I had the same problem, before I learned the essentials" or something like that).