Very cool, thanks B+. I've also been wondering about how I used to use XOR with PUT to make graphics put on top of other graphics and the rest remains, without having to draw it again. Might be something for me to look into if it's still online somewhere.
I don't know if XOR is used that much unless manipulating bits, you're talking numbers in binary format.
Let's stick to elements this thread brings up. I would spend my time learning _PUTIMAGE over the old way of PUT.
We could practice with the monster image. Can you set up an area to draw the monster using _NEWIMAGE, draw the monster there with the data statements (then you don't need an array to store the colors nor have to redraw from array, just use _PUTIMAGE). This is when you learn _SOURCE and _DEST, specially _DEST for telling QB where images are coming from (_SOURCE) and are to go (_DEST) that's what _PUTIMAGE needs the most.
'set up Monster area to draw it and store image under the handle monster& << notice type long
monster&
= _NEWIMAGE(12, 12, 32) 'the monster is 13 x 13 which is 0 to 12 X 0 to 12_DEST monster&
'<<< drawing commands will now go to monster& area FOR my
= 0 TO 12 'draw monster in monster& image area 'we now have a monster image stored under the handle monster&
_DEST 0 ' back to the screen
Use _PUTIMAGE to show monster. Here is the "monster" Swiss army knife of _PUTIMAGE command:
' _PUTIMAGE [STEP] [(dx1, dy1)-[STEP][(dx2, dy2)]][, sourceHandle&][, destHandle&][, ][STEP][(sx1, sy1)[-STEP][(sx2, sy2)]]
dx, dy controls where on screen for top, left corner, bottom right corner, the monster image will stretch or shrink to fit there dx, dy coordinates you specify. d stand for destination which is main screen for our monster&
(dx1, dy1) is top left corner
(dx2, dy2) is bottom left corner
with these you can control how big or small to show the monster on main screen.
Source handle is monster&
Destination handle is 0 for default screen
sx, sy controls what parts to show from source image, we are using whole image so those options remain blank
This code replace load array colors of monster and _PUTIMAGE replaces the GOSUB showMonster:
Still need:
monsterdata:
DATA 0,0,0,4,4,4,4,4,4,4,0,0,0
DATA 0,0,4,4,4,4,4,4,4,4,4,0,0
DATA 0,4,4,4,4,4,4,4,4,4,4,0,0
DATA 0,4,4,4,4,4,4,4,4,4,4,0,0
DATA 4,4,4,1,1,4,4,1,1,4,4,4,0
DATA 4,4,4,4,4,4,4,4,4,4,4,4,0
DATA 4,4,4,4,4,4,1,4,4,4,4,4,0
DATA 4,4,4,4,4,1,1,4,4,4,4,4,0
DATA 0,4,4,4,4,4,4,4,4,4,0,0,0
DATA 0,0,4,4,1,1,1,1,4,4,0,0,0
DATA 0,0,4,4,4,4,4,4,4,4,0,0,0
DATA 0,0,4,4,4,4,4,4,4,4,0,0,0
DATA 0,0,4,4,4,4,4,4,4,0,0,0,0