Qbasicnews.com
November 20, 2019, 12:54:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: PUT sprite with mask?  (Read 3338 times)
Meg
Ancient QBer
****
Posts: 483


« on: February 09, 2007, 11:50:04 PM »

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.
Logged
Plasma
Na_th_an
*****
Posts: 1770


WWW
« Reply #1 on: February 10, 2007, 12:02:59 AM »

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
Logged
Anonymous
Guest
« Reply #2 on: February 15, 2007, 01:17:02 PM »

Damn, I wish they would've put a 'trans' flag in PUT.

*waits for a language that does*
Logged
Skyler
Ancient Guru
****
Posts: 564



« Reply #3 on: February 15, 2007, 01:19:15 PM »

It's called RelLib, cha0s.
Logged

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
Zap
Been there, done that
*****
Posts: 1124


« Reply #4 on: February 16, 2007, 01:32:47 PM »

I think he was making a subtle reference to fb Tongue
Logged

url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Skyler
Ancient Guru
****
Posts: 564



« Reply #5 on: February 16, 2007, 01:36:06 PM »

Nonsense. This is a QB forum.
Logged

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
nkk_kan
Member
*
Posts: 73


« Reply #6 on: February 19, 2007, 11:55:33 AM »

that's why it was subtle  Tongue
Logged

\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Anonymous
Guest
« Reply #7 on: February 24, 2007, 07:45:54 AM »

:longeye:
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!