So in etwa, das musst du nur an geeignet Stelle in deinen Code einfügen (im EventLoop)
edit: Hab hier mal auf die Schnelle ein lauffähiges Beispiel zusammen geschustert. Schlecht formatierter Code und nicht kommentiert, aber soll auch wirklich nur ein kurzes Beispiel sein.
Code: Alles auswählen
InitSprite()
InitKeyboard()
Define intensity.f
LoadFont(0,"Arial",60)
Define text.s = "GAME OVER"
OpenWindow(0,0,0,640,480,"MyGame",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,640,480)
CreateSprite(0,640,480)
StartDrawing(SpriteOutput(0))
Box(0,0,640,480,RGB(Random(255), Random(255), Random(255)))
DrawingFont(FontID(0))
DrawingMode(#PB_2DDrawing_Transparent )
DrawText(320-TextWidth(text)/2, 240-TextHeight(text)/2, text)
StopDrawing()
CreateSprite(1,640,480)
StartDrawing(SpriteOutput(1))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
Circle(Random(640),Random(480), Random(100),RGB(Random(255), Random(255), Random(255)))
StopDrawing()
Repeat
ExamineKeyboard()
event=WaitWindowEvent(10)
ClearScreen(0)
DisplaySprite(1,0,0)
If gameover=#True
If intensity >= 254
intensity=255
Else
intensity+2
EndIf
DisplayTransparentSprite(0, 0, 0, intensity)
EndIf
If KeyboardReleased(#PB_Key_Space)
If gameover=#True
gameover=#False
intensity=0
SetWindowTitle(0, "MyGame")
Else
gameover=#True
SetWindowTitle(0, "MyGame [GAME OVER]")
EndIf
EndIf
FlipBuffers()
Until event = #PB_Event_CloseWindow