Even though I'm not using RGBA; I'm using RGB. I have to erase the ball sprite using Alpha.
In my opinion, while utilizing RGB, I shouldn't have to use Alpha in my code.
Could someone please check my code to see if there are any mistakes?
Here's an example:
Code: Select all
' sprite erase ball test without using CLS
' updated code using Pset
Screenres 640, 480, 32
Dim As Any Ptr DrawBall = ImageCreate( 80, 80, RGB(255, 255, 255))
Dim As Any Ptr EraseBall = ImageCreate( 80, 80, RGB(255, 255, 255))
Dim As Integer x, y, i
x = 40: y = 40
CIRCLE DrawBall, (x, y), 37, RGB(0, 255, 0),,,,F ' Green
' not needed
' CIRCLE EraseBall, (x, y), 37, RGB(0, 0, 0),,,,F ' Black
Color rgb(0 ,0, 0), rgb(255,255,255)
Cls
x = 10
for i = 1 to 136
ScreenLock
' this erases the ball using Alpha
' old code
' put(x, y),EraseBall, Alpha
' updated code
' Pset is needed to erase sprite
put (x, y), EraseBall, Pset
' this does not erase the ball as it should
' put(x, y),EraseBall
x += 4 ' move the ball 4 pixels at a time
' old code
' put(x, y),DrawBall
' updated code
' if you don't use Pset here it messes up the colors
put(x, y),DrawBall, Pset
ScreenUnlock
Sleep 5, 1
next
Locate 10,35:Print "Test Ended"
ImageDestroy DrawBall
ImageDestroy EraseBall
sleep