Posts: 480
Threads: 24
Joined: Mar 2003
Quick question:
Is there any way to PUT a sprite such that all non-black pixels are PSET, and all black pixels are ignored? None of the PUT action command words seem to do this.
*peace*
~ Megan.
Posts: 1,752
Threads: 21
Joined: Jun 2002
Yes, you can either use a mask/sprite combination or SuperPut. Here's an example using a mask:
Code: DEFINT A-Z
SCREEN 13
DIM SpriteImage(129)
DIM SpriteMask(129)
DIM SaveBackground(129)
'Create the sprite
LINE (0, 0)-(15, 15), 255, BF
CIRCLE (8, 8), 7, 4, , , .83
PAINT (8, 8), 4
CIRCLE (10, 7), 2, 12, , , .83
PAINT (10, 7), 12
GET (0, 0)-(15, 15), SpriteImage(0)
'Create the mask from the sprite
FOR y = 0 TO 15
FOR x = 0 TO 15
IF POINT(x, y) = 255 THEN
PSET (x + 16, y), 0
ELSE
PSET (x + 16, y), 255
END IF
NEXT
NEXT
GET (16, 0)-(31, 15), SpriteMask(0)
CLS
'Draw some shiznit on the screen
FOR x = 0 TO 319
LINE (x, 0)-(x, 199), x AND 255
NEXT
FOR x = 0 TO 304
'Wait for vsync
WAIT &H3DA, 8, 8
WAIT &H3DA, 8
'restore old background
IF x > 0 THEN PUT (x - 1, 92), SaveBackground(0), PSET
'save new background
GET (x, 92)-(x + 15, 107), SaveBackground(0)
'Put sprite while preserving background
PUT (x, 92), SpriteMask(0), OR
PUT (x, 92), SpriteImage(0), AND
NEXT
Damn, I wish they would've put a 'trans' flag in PUT.
*waits for a language that does*
Posts: 421
Threads: 22
Joined: Oct 2005
It's called RelLib, cha0s.
In the beginning, there is darkness â the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Posts: 838
Threads: 17
Joined: Jan 2002
I think he was making a subtle reference to fb
url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Posts: 421
Threads: 22
Joined: Oct 2005
Nonsense. This is a QB forum.
In the beginning, there is darkness â the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Posts: 72
Threads: 6
Joined: Jun 2006
that's why it was subtle
\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
|