La demo qui roxxx of the dead!!!

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
raven
Messages : 222
Inscription : jeu. 06/janv./2005 15:45

Re: La demo qui roxxx of the dead!!!

Message par raven »

Kwai chang caine a écrit :Put...on s'croirait en boite .... 8O
Jolie cette partie 2 8)
:mrgreen:
partie 3:

-ajout d'un timer
-2 effets
-image de fond
-nouvelle musique
-le programme se termine automatiquement.

les medias est le code sont inclue dans l'archive.
https://www.dropbox.com/s/xn9q67kdbbhby ... o.rar?dl=0

Code : Tout sélectionner

;******************************
;   The One Pixel Megademo
;             par raven       
;  La demo qui roxxxx of the Dead !!!!  
;           Debugger : Ok   
;         Programme : Fun       
;******************************



Enumeration
   #font
EndEnumeration

Enumeration
   #music
EndEnumeration

Enumeration
   #pixel
   #ligne
   #ligne2 = 1014
   #dance
  EndEnumeration

Declare pixel() ;on Declare la procedure du pixel 
Declare affiche_menu() ; on declare la procedure affiche_menu
Declare guru() ; on declare la procedure guru


;-variable globale
Global WindowW.f=1024
Global WindowH.f=768
Global xpixel,ypixel,xpixeldir,ypixeldir,x_box,y_box,tempo,image
image=0.0
temp=0

vitesse.f=0.0
;position du pixel de depart
xpixel=450: ypixel=450: xpixeldir=-1 : ypixeldir=-2

;-procédure affiche menu
Procedure affiche_menu()
   If StartDrawing(ScreenOutput())
      
      If affiche_menu = #False
         DrawingFont(FontID(#font))
         DrawingMode((#PB_2DDrawing_AlphaBlend ))      
         
         DrawText(385+Random(2),40+ Random(3), "The One Pixel ", RGB(255* tempo,155* tempo,0))
         
         DrawText(415+Random(2),80+ Random(2), "Megamix ",RGB($00,$00,$ff))     
         
         DrawText(435+Random(2),120+ Random(2), "Part III ",RGB($ff,$ff,$00))
         
         DrawText(5+Random(2),730+Random(2),"Musique:Ghidorah",RGB(120,150,255))
         
         DrawText(5+Random(2),695+Random(2), "Code: Raven ",RGB($ff,$ff,$ff))  
         
      EndIf
      StopDrawing()
   EndIf 
EndProcedure

;-procédure pixel
Procedure pixel()
   SpriteBlendingMode(#PB_Sprite_BlendSourceAlpha, #PB_Sprite_BlendSourceAlpha)
   CreateSprite(#ligne,1024,10,#PB_Sprite_BlendSourceAlpha)
   xpixel=xpixel+xpixeldir
   ypixel=ypixel+ypixeldir
   
   If xpixel <10 Or xpixel >1024-40 : xpixeldir=xpixeldir*-1 : EndIf
   If ypixel <10 Or ypixel >768-50 : ypixeldir=ypixeldir*-1 : EndIf
   CreateSprite(#pixel, 1, 1)
   
   StartDrawing(SpriteOutput(#pixel))    
      Plot(#pixel, 0, RGB(Random(0), Random(15), Random(15)))  
   StopDrawing()
   
   ;-on affiche le pixel  qui roxxxx :)
   DisplayTransparentSprite(#pixel, xpixel,ypixel)
   
   For i = 0 To 100
      DisplayTransparentSprite(#pixel,xpixel+i*Cos(i*8+vitesse),ypixel+i*Sin(i*8+vitesse)) 
      ZoomSprite(#pixel,50,50)
      RotateSprite(#pixel,ypixel,vitesse)
      vitesse +0.5      
   Next i
   
EndProcedure

;procedure pixel2
Procedure pixel2()
   SpriteBlendingMode(#PB_Sprite_BlendSourceAlpha, #PB_Sprite_BlendSourceAlpha)
   CreateSprite(#ligne,1024,10,#PB_Sprite_BlendSourceAlpha)
   xpixel=xpixel+xpixeldir
   ypixel=ypixel+ypixeldir
   
   If xpixel <10 Or xpixel >1024-40 : xpixeldir=xpixeldir*-1 : EndIf
   If ypixel <10 Or ypixel >768-50 : ypixeldir=ypixeldir*-1 : EndIf
   CreateSprite(#pixel, 1, 1)
   
   StartDrawing(SpriteOutput(#pixel))    
      Plot(#pixel, 0, RGB(Random(0), Random(15), Random(15)))  
   StopDrawing()
   ;-on affiche le pixel  qui roxxxx :)
   DisplayTransparentSprite(#pixel, xpixel,ypixel)
   
   For i = 0 To 1000
      DisplayTransparentSprite(#pixel,xpixel+i*Cos(i*8+vitesse),ypixel+i*Sin(i*8+vitesse)) 
      ZoomSprite(#pixel,50,50)
      RotateSprite(#pixel,ypixel,vitesse)
      vitesse +0.5      
   Next i
   
EndProcedure

Procedure guru()
   
   StartDrawing(ScreenOutput())
      DrawingMode((#PB_2DDrawing_AlphaBlend ))
      DrawingFont(FontID(#font))
      
      DrawText(120,30, "software failure.     Press left mouse button to continue", RGB(255,0,0))   
      DrawText(220,90, "guru meditation #00000004.0000AAC0", RGB(255,0,0))
      
      If image=2:image=0:EndIf
      Box(#ligne,10,1024*image,10,RGB(255,0,0))       
      Box(#ligne,20,10*image,140,RGB(255,0,0))  
      Box(#ligne,150,1024*image,10,RGB(255,0,0)) 
      Box(#ligne2,20,10*image,140,RGB(255,0,0))  
      
      tempo + 1
      If tempo = 40
         image + 1
         tempo = 0
      EndIf
      
   StopDrawing()
   
EndProcedure

;-Procédure zik
Procedure Musique() 
   
   music=CatchMusic(#music,?musique,?fin_musique-?musique)
   If music
      PlayMusic(#music) 
   EndIf
   
EndProcedure

;-procédure pour quitter
Procedure Quitter()
   
   FreeFont(#font)
   FreeSprite(#pixel) ; pixel
   FreeMusic(#music) 
   
EndProcedure

;procédure dance
Procedure dance()
   
   dance=CatchSprite(#dance,?image_fond,#PB_2DDrawing_AlphaBlend)
   DisplayTransparentSprite(#dance,270,370, RGB(Random(150), Random(15), Random(150+tempo)))  
   
   tempo + 1
   If tempo = 50
      image + 1
      tempo = 0
   EndIf
   
EndProcedure

;- Initialisations
If InitSprite()=0 Or InitKeyboard()=0 Or InitMouse()=0 Or InitSound()=0 Or UseOGGSoundDecoder()=0 Or UsePNGImageDecoder() =0
   MessageRequester("Problème","Initialisations impossibles",0)
   End
EndIf

;-charge la fonte
LoadFont(#font,"Cooper Black",24,#PB_Font_HighQuality )

;-ouvre une fenetre
If OpenWindow (0,0,0,WindowW,WindowH, "The One Pixel Megademo" , #PB_Window_SystemMenu | #PB_Window_ScreenCentered )
   If OpenWindowedScreen (WindowID (0),0,0,WindowW,WindowH,1,0,0)
      
      ;- Boucle Principale
      ClearScreen (RGB(0,0,0))  
      ; on appelle la procédure musique
      musique()
      
      Repeat 
         temp +1
         
         ;-clavier et souris
         ExamineKeyboard()
         ExamineMouse()
         
         event=WaitWindowEvent(10)
         ;-on appelle les procédures
         
         If temp >0 And temp <430
            ClearScreen(rgb(0,0,0))
            guru()
         EndIf
         
         If temp >430 And temp <4850
            ClearScreen(rgb(0,0,0))
            dance()
            affiche_menu()
            pixel()
         EndIf
         
         If temp >4850 And temp <8700
            ClearScreen (RGB(0,0,0))  
            dance()
            affiche_menu()
            pixel2()
         EndIf
         
         
         FlipBuffers()
         ClearScreen(RGB(0,0,0))
         
      Until temp >8700 Or KeyboardPushed(#PB_Key_Escape)  Or event=#PB_Event_CloseWindow
      Quitter()
   EndIf
EndIf

End

;-Data
DataSection
   image_fond:
   IncludeBinary "dance.png"
   musique:
   IncludeBinary "cappella.xm"
   fin_musique:
   
; Epb
Pb5.24 Lts/5.31 Windows 7 64 nvidia 560 ti E8500 8g ram
Répondre