Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bsave and Bload problems...
#21
Quote:I'm totally confused... Can anybody tell me how big array must I dim for 9x9 image in SCREEN 7 pls? Smile

In SCREEN 7 you have 16 colours. Each one can be represented by 4 bits, that's the half of a byte. So you need an amount of memory that's equal to the number of pixels divided by two.

9x9 -> 81 pixels; 81/2 = 41 if we round it up.

You are creating an integer array to hold this data, and an integer takes 2 bytes. So the array has to have as much indexes as the number of bytes divided by two, rounded up:

41 bytes -> 41/2 = 21 if we round up.

So we need 21 integer array positions to store 41 bytes. We also need two extra array positions so GET can store width/height, that makes a total of 43 array positions.

As QB arrays begin in 0, you have to DIM your array this way:

Code:
DIM sprite%(42)
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#22
Quote:
Eurodance Wrote:I'm totally confused... Can anybody tell me how big array must I dim for 9x9 image in SCREEN 7 pls? Smile


So we need 21 integer array positions to store 41 bytes. We also need two extra array positions so GET can store width/height, that makes a total of 43 array positions.

As QB arrays begin in 0, you have to DIM your array this way:

Code:
DIM sprite%(42)

If I understood you correctly, it must look so:

Code:
DIM sprite%(22)

because 21 + 2 isn't 43 :lol:
EEL THE BEAT OF EURODANCE!!! Smile
Reply
#23
Sure Big Grin I made a mess with myself Wink now EDITed
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#24
Big Grin
EEL THE BEAT OF EURODANCE!!! Smile
Reply
#25
Big Grin
EEL THE BEAT OF EURODANCE!!! Smile
Reply
#26
And I must BSAVE 2*23=46 bytes?
EEL THE BEAT OF EURODANCE!!! Smile
Reply
#27
I tested it and it doesn't work Sad
It must be dimmed at least to 41 bytes:

Code:
DIM Sprite%(41)

I don't understand...
EEL THE BEAT OF EURODANCE!!! Smile
Reply
#28
FINALLY!

DIM Sprite%(37)

or

DIM Sprite%( 1 TO 38 )

and that said the formula in QB help Smile
EEL THE BEAT OF EURODANCE!!! Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)