Hey all, I have been having a problem with the get image command. I have a image which I wish to split up into 20 tiles wide by 15 tiles tall (32x32). My problem is that it is very annoying having a huge list of each individual Get Image command:
get image 500,0,0,32,32
get Image 501,32,0,64,32
get Image 502,64,0,96,32
get image 503,0,32,32,64
get Image 504,32,32,64,64
get Image 505,64,32,96,64
get image 506,0,64,32,96
get Image 507,32,64,64,96
get Image 508,64,64,96,96
get image 509,0,96,32,128
get Image 510,32,96,64,128
get Image 511,64,96,96,128
get image 512,0,128,32,160
get Image 513,32,128,64,160
get Image 514,64,128,96,160
get image 515,0,160,32,192
get Image 516,32,160,64,192
get Image 517,64,160,96,192
So, obviously if I need to split this image up, the most logical route would be to put this in a for next loop. Although, when I do this I get some interesting and varying results depending on the method:
For Img = 520 to 539
For Left = 0 to 19
Left = Left*32
Right = Left+32
Top = 32 : Bottom = 64
Get Image Img,Left,Top,Right,Bottom
Next Img
Next Left
For Img = 540 to 559
For Left = 0 to 19
Left = Left*32
Right = Left+32
Top = 64 : Bottom = 96
Get Image Img,Left,Top,Right,Bottom
Next Img
Next Left
This gives me an error saying that the image does not exist when i paste the tiles, however the highest tile I paste is of image number 525.
For Img = 520 to 539
For Left = 0 to 608 Step 32
For Right = 32 to 640 Step 32
Top = 32 : Bottom = 64
Get Image Img,Left,Top,Right,Bottom
Next Right
Next Img
Next Left
For Img = 540 to 559
For Left = 0 to 608 Step 32
For Right = 32 to 640 Step 32
Top = 64 : Bottom = 96
Get Image Img,Left,Top,Right,Bottom
Next Right
Next Img
Next Left
This results in an error saying that I have an illegal image area and therefore cannot copy.
Other results I have gotten from miscellaneous experimenting is a complete white background which all the tiles overhead and under are white. Another one is that I have had it paste only 2 different tiles (the wrong ones needless to say), and none of the others.
Is there something about this command that doesn't like the For loops? Or probably just the way I have it set up? I only ask because having to type out about 300 lines of get image img,l,t,r,b would be absolutely ridiculous. Any help on this matter would be greatly appreciated. Thanks
Just tried this:
Img = 500
Left = 0
Right = 32
Top = 0 : Bottom = 32
Do
If Img > 519
Left = 0 : Right = 32 : Top = 32 : Bottom = 64
endif
If Img > 539
Left = 0 : Right = 32 : Top = 64 : Bottom = 128
endif
If Img > 559
Left = 0 : Right = 32 : Top = 128 : Bottom = 160
endif
If Img > 579
Left = 0 : Right = 32 : Top = 160 : Bottom = 192
endif
If Img > 599
Left = 0 : Right = 32 : Top = 192 : Bottom = 224
endif
If Img > 619
Left = 0 : Right = 32 : Top = 224 : Bottom = 256
endif
If Img > 639
Left = 0 : Right = 32 : Top = 256 : Bottom = 288
endif
If Img > 659
Left = 0 : Right = 32 : Top = 288 : Bottom = 320
endif
If Img > 679
Left = 0 : Right = 32 : Top = 320 : Bottom = 352
endif
If Img > 699
Left = 0 : Right = 32 : Top = 352 : Bottom = 384
endif
If Img > 719
Left = 0 : Right = 32 : Top = 384 : Bottom = 416
endif
If Img > 739
Left = 0 : Right = 32 : Top = 416 : Bottom = 448
endif
If Img > 759
Left = 0 : Right = 32 : Top = 448 : Bottom = 480
endif
If Img > 779 then gosub MainLoop:
Get Image Img,Left,Top,Right,Bottom
Inc Img,1
Inc Left,32
Inc Right,32
Sync : Loop
This didn't give any good results either, just more errors about image area and the image not existing.