Try this example. Copy code and run.
`##################################################
`# SPRITE ALHPA EXAMPLE - YATTA! #
`##################################################
`Not really necessary for the example, but good to make a habbit of in case you
`need to use a variable in a function. Also good to get used to declaring stuff :)
Global MyBlock: MyBlock = 1
Global Opacity: Opacity = 255
`This is just to make an image we can use for the example
Cls
INK RGB(250, 100, 100), RGB(0,0,0)
Box 0, 0, 100, 100
Get Image MyBlock, 0, 0, 100, 100
`Colour our backdrop black coz black is awesome
Color Backdrop RGB(0,0,0)
`Main loop
Do
`Place our bax wherever the mouse is
Sprite MyBlock, MouseX(), MouseY(), MyBlock
`Print the necessary information to the screen
INK RGB(255,255,255), RGB(0,0,0)
Text 1, 1, "Left-Click to increase opacity"
Text 1, 20, "Right-Click to decrease opacity"
Text 1, 40, "Current Opacity:" + str$(Opacity)
`Increase or decrease object's opacity based on mouse clicking
If MouseClick() = 1 then INC Opacity, 1
If MouseClick() = 2 then INC Opacity, -1
`Limit opacity range. Wrap values can be achieved using a byte instead of an integer.
If Opacity > 255 then Opacity = 255
If Opacity < 0 then Opacity = 0
`The most important command, we set the alpha.
Set Sprite Alpha MyBlock, Opacity
Loop