### Author Topic: [Mini Tutorial] How to flip around 8x8 sprite data  (Read 2348 times)

0 Members and 1 Guest are viewing this topic.

#### Yeong

• Not a bridge
• LV12 Extreme Poster (Next: 5000)
• Posts: 3739
• Rating: +278/-12
• Survivor of Apocalypse
##### [Mini Tutorial] How to flip around 8x8 sprite data
« on: December 16, 2011, 11:27:19 am »
Let's hope that this will be useful to somebody

Let's say you have this sprite data for example: [1818101C10282828]

Horizontal Flipping:

1. separate the data by 2 digits: [ 18 18 10 1C 10 28 28 28 ]
2. switch the order of 2 digits   : [ 81 81 01 C1 01 82 82 82 ]
3. Now change each digit to its complement(Is this what these are called?)
Here's the list if you don't know it.
0↔0  1↔8   2↔4  3↔C  5↔A  6↔6  7↔E  9↔9  B↔D  F↔F
So if we change it, it should be: [ 18 18 08 38 08 14 14 14 ]

So the result is: [1818083808141414]!

Vertical Flipping:

This thing is easier than the horizontal flipping.

1. separate the data by 2 digits: [ 18 18 10 1C 10 28 28 28 ]
2. switch the places around (First set with last set, 2nd set with 7th set, etc)
So it should look like: [ 28 28 28 10 1C 20 18 18 ]

So the result is: [282828101C201818]!
« Last Edit: December 16, 2011, 11:28:05 am by TBO_Yeong »
Sig wipe!

#### Runer112

• Project Author
• LV11 Super Veteran (Next: 3000)
• Posts: 2289
• Rating: +639/-31
##### Re: [Mini Tutorial] How to flip around 8x8 sprite data
« Reply #1 on: December 16, 2011, 11:54:07 am »
It's probably worth mentioning that, for flipping sprites during program execution, you don't have to implement those algorithms yourself. Just use the built-in flipH() and flipV() commands.

#### Yeong

• Not a bridge
• LV12 Extreme Poster (Next: 5000)
• Posts: 3739
• Rating: +278/-12
• Survivor of Apocalypse
##### Re: [Mini Tutorial] How to flip around 8x8 sprite data
« Reply #2 on: December 16, 2011, 12:25:19 pm »
but didn't those two had a some kind of restriction?
Sig wipe!

#### Quigibo

• The Executioner
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2031
• Rating: +1075/-24