Hallo liebe PB Community,
ich möchte einen GameOver Bild Sprite über den Spielescreen von 0 Tranmsparenz auf 100% voll Sichtbar einblenden.
Ich weis aber nicht wie ich das tue.
Ob über den DrawingMode und/oder DisplayTransparentSprite.
Das ich mit ner for next schleife hochzähle.
Ka so richtig vllt könnt ihr mir da weierhelfen.
Danke
Grüße
Von Total Transparent zu Voll Sichtbar
Von Total Transparent zu Voll Sichtbar
The World is Cyber
Re: Von Total Transparent zu Voll Sichtbar
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.
Mit Leertaste wird der Game Over Zustand aktiviert und deaktiviert (reset).
Code: Alles auswählen
If gameover=#True
If intensity < 255
intensity+1
Endif
DisplayTransparentSprite(#GameOver, 0, 0, intensity)
Endif
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.
Mit Leertaste wird der Game Over Zustand aktiviert und deaktiviert (reset).
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
Signatur und so
Re: Von Total Transparent zu Voll Sichtbar
Hi Danke^^
Er meldet bei mir DisplayTransparentSprite falsche zahl an Parameter.
Er meldet bei mir DisplayTransparentSprite falsche zahl an Parameter.
The World is Cyber
Re: Von Total Transparent zu Voll Sichtbar
Zeit für ein Update?NeoRon hat geschrieben:Er meldet bei mir DisplayTransparentSprite falsche zahl an Parameter.
PB-Historie hat geschrieben:17th September 2013 : Version 5.20 LTS
- Added: 'Color' and 'Intensity' parameter to DisplayTransparentSprite()
a²+b²=mc²
Re: Von Total Transparent zu Voll Sichtbar
Danke Leute.
Lag an der alten Version. Habs geupdated.
Lag an der alten Version. Habs geupdated.
The World is Cyber