06-19-2004, 06:10 PM
As I wrote recently, that depends on whether the resulting number of multiplying width by height is odd or even.
If it is odd, say for example "7", you have 7\2 = 3, but with 3 integers you can only store 6 bytes. You need an extra integer.
The correct expression would be:
But the CEIL (round up) command doesn't exist in QB, so the golden rule is add 1 if w*h is even or 2 if w*h is odd.
Anyhow, if you use sprites with sizes that are powers of two, the result is always even.
I've said this tons of times: use sizes that are powers of two: the calculations are faster.
If it is odd, say for example "7", you have 7\2 = 3, but with 3 integers you can only store 6 bytes. You need an extra integer.
The correct expression would be:
Code:
Dimmension% = CEIL(( Width% * Height%) / 2) + 1
But the CEIL (round up) command doesn't exist in QB, so the golden rule is add 1 if w*h is even or 2 if w*h is odd.
Anyhow, if you use sprites with sizes that are powers of two, the result is always even.
I've said this tons of times: use sizes that are powers of two: the calculations are faster.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i