SaveBrush(), then LoadBrush() fails?
Posted: Tue Jun 08, 2010 8:31 am
I have thisw 320 x 256 pixel picture that has my games object/character pictures in it.
I have loop like this:
tempnumber=0
tempx=1
tempy=1
loop starts--->
tempnumber=tempnumber+1
tempx = tempx + 40
if tempx > 320
tempx=1
tempy=tempy+40
endif
createbrush(i, 38, 38)
selectbrush(i)
DisplayBGPicPart(1, tempx, tempy, 38, 38)
Savebrush(i, "brushes/brush"..i..".brs")
LoadBrush(i, "brushes/brush"..i..".brs", {transparency=#Black})
loop ends<----
So basically it just keeps adding higher value to X and Y so that all brushes from premade picture are took and made.
Strange part in this is, that it keeps failing at certain points.
There are 8 x 6 brushes in that picture.
If i run it like i nthis example, then it fails at brush 8, which is at placing Y-row 1 and X-row 8.
That can make sense that there could be some reason of it going too much right or something (trying to grab partr over x320) after all, it is most right row.
However, if i change that "If tempx > 320" to "If Tempx > 280" i get no problems until brush 34, which is located at y-row 5 and x-row 6 (an the whole thing is 7x6 since eighth row from x is left out), now this one makes no sense at all to bug.
Its not bottom most, since previous 5 have been same Y-row as well. Its not either right most, since there have been took x-row 7 too in previous y-rows. So wwhy does it in middle of everything decide that brush 34 is not valid one?
In both cases, in 8x6 grids brush 8, and 7x6 grids bursh 34, it complains when it tries to load the brush that file is unknown type or something similar.
Anyone have any idea why thsi happens? Is there something wrong with my PNG picture?
I have loop like this:
tempnumber=0
tempx=1
tempy=1
loop starts--->
tempnumber=tempnumber+1
tempx = tempx + 40
if tempx > 320
tempx=1
tempy=tempy+40
endif
createbrush(i, 38, 38)
selectbrush(i)
DisplayBGPicPart(1, tempx, tempy, 38, 38)
Savebrush(i, "brushes/brush"..i..".brs")
LoadBrush(i, "brushes/brush"..i..".brs", {transparency=#Black})
loop ends<----
So basically it just keeps adding higher value to X and Y so that all brushes from premade picture are took and made.
Strange part in this is, that it keeps failing at certain points.
There are 8 x 6 brushes in that picture.
If i run it like i nthis example, then it fails at brush 8, which is at placing Y-row 1 and X-row 8.
That can make sense that there could be some reason of it going too much right or something (trying to grab partr over x320) after all, it is most right row.
However, if i change that "If tempx > 320" to "If Tempx > 280" i get no problems until brush 34, which is located at y-row 5 and x-row 6 (an the whole thing is 7x6 since eighth row from x is left out), now this one makes no sense at all to bug.
Its not bottom most, since previous 5 have been same Y-row as well. Its not either right most, since there have been took x-row 7 too in previous y-rows. So wwhy does it in middle of everything decide that brush 34 is not valid one?
In both cases, in 8x6 grids brush 8, and 7x6 grids bursh 34, it complains when it tries to load the brush that file is unknown type or something similar.
Anyone have any idea why thsi happens? Is there something wrong with my PNG picture?