Page 1 of 1
OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 12:05 pm
by SPH
Hi,
My game runs on PB6.20 but not on PB6.21b9.
I tried to find the bug, but I can't find it yet...
Code here :
viewtopic.php?t=86911
// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)
Re: OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 12:54 pm
by infratec
As written in the error message:
add #PB_Sprite_AlphaBlending at all CreateSprite() procedures.
Re: OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 1:05 pm
by diceman
FYI: TransparentSpriteColor() no longer defaults to full black - now it has to be defined always, after creating a new Sprite.

Re: OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 1:49 pm
by SPH
[14 :43 :02] Attente du démarrage du programme...
[14 :43 :02] Type d'exécutable: Windows - x64 (64bit, Unicode)
[14 :43 :02] Exécutable démarré.
[14 :43 :09] [ERREUR] Magic_4x4_12a.pb (Ligne: 773)
[14 :43 :09] [ERREUR] DisplayTransparentSprite(): A sprite should be created with the flag #PB_Sprite_AlphaBlending to use this command.
[14 :43 :31] Le programme a été arrêté.
Does the solution exist with this beta 9?
(If so, which one? Because I heard that the option will only be available in the future non-beta version)
Or should I wait for version PB 6.30?
Re: OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 4:23 pm
by miso
Hello SPH. It won't be resolved, the flag will be necessary after the beta. It has it's reason.
Good news, that the flag is compatible with the old versions, so you can add them now, it will still work with 6.20 (and I guess with 5.73 also)
but will compile with the beta and the future releases. PS:I already told, your game is cool.

Re: OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 5:55 pm
by dcr3
SPH wrote: Sat May 31, 2025 1:49 pm
Does the solution exist with this beta 9?
Yes?
infratec wrote: Sat May 31, 2025 12:54 pm
As written in the error message:
add #PB_Sprite_AlphaBlending at all CreateSprite() procedures.
Just add #PB_Sprite_AlphaBlending
CreateSprite(0, zoom/rang,zoom/rang,#PB_Sprite_AlphaBlending)
CreateSprite(1000, zoom/rang,zoom/rang,#PB_Sprite_AlphaBlending)
CreateSprite(i, zoom/rang,zoom/rang,#PB_Sprite_AlphaBlending)
Re: OK on PB6.20 and ERROR on PB6.21b9
Posted: Sat May 31, 2025 6:01 pm
by miso
Sorry. Yes, the solution exists since 5.73 (at least), but was not necessary to use until the recent beta.
Edit: This sprite creation method worked for me the best. Works with both the beta or the current or older versions.
For transparent color instead of alpha channel, diceman can add more info, as he uses that method heavily in his game.
Code: Select all
ExamineDesktops()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0,0,0,DesktopUnscaledX(DesktopWidth(0)),DesktopUnscaledY(DesktopHeight(0)),"Sprite Creation", #PB_Window_BorderLess)
OpenWindowedScreen(WindowID(0),0,0,WindowWidth(0),WindowHeight(0),1,0,0,#PB_Screen_SmartSynchronization)
SetFrameRate(60)
;Sprite Creation
CreateSprite(1,64,64,#PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(1))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,OutputWidth(),OutputHeight(),RGBA(0,0,0,0)) ; This sets the alpha channel to transparent fully
Circle(OutputWidth()/2,OutputHeight()/2,SpriteHeight(1)/2-1,RGBA(255,0,0,255)) ; drawing a red circle
StopDrawing()
Repeat
Repeat: Until Not WindowEvent()
ExamineKeyboard() : ExamineMouse() : ClearScreen(RGB(50,20,20))
DisplayTransparentSprite(1,ScreenWidth()/2-SpriteWidth(1)/2,ScreenHeight()/2-SpriteHeight(1)/2)
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)