GrabSprite and #PB_Sprite_AlphaBlending flag.

Just starting out? Need help? Post your questions and find answers here.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 612
Joined: Tue Jan 04, 2011 6:21 pm

GrabSprite and #PB_Sprite_AlphaBlending flag.

Post by SPH »

Hi,

I'm creating sprites using the GrabSprite instruction.

Code: Select all

For u=1 To 8
  GrabSprite(u,74,4+(u-1)*taille_y,taille_x,taille_y)
Next
But PB6.30 requires me to use the #PB_Sprite_AlphaBlending flag.
[21 :09 :33] [ERREUR] DisplayTransparentSprite(): A sprite should be created with the flag #PB_Sprite_AlphaBlending to use this command.
How do I use it with a grab?

I use that but it,s not ok :

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
User avatar
STARGÅTE
Addict
Addict
Posts: 2263
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: GrabSprite and #PB_Sprite_AlphaBlending flag.

Post by STARGÅTE »

Code: Select all

GrabSprite(u,74,4+(u-1)*taille_y,taille_x,taille_y, #PB_Sprite_AlphaBlending)
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
miso
Enthusiast
Enthusiast
Posts: 499
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: GrabSprite and #PB_Sprite_AlphaBlending flag.

Post by miso »

The screen has no transparency channel to grab though. Drawing an image then grabbing it to sprite can be replaced. You can draw the image part to a newly created sprite directly (instead of the screen), or just load the whole as a single sprite atlas, and use clipsprite to get your individual sprite from it.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 612
Joined: Tue Jan 04, 2011 6:21 pm

Re: GrabSprite and #PB_Sprite_AlphaBlending flag.

Post by SPH »

STARGÅTE wrote: Fri Nov 21, 2025 9:33 pm

Code: Select all

GrabSprite(u,74,4+(u-1)*taille_y,taille_x,taille_y, #PB_Sprite_AlphaBlending)
Thank you... but the sprite is invisible (transparent?)

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
Post Reply