Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Enumeration
  2.   #Flake
  3.   #WinHeight = 600
  4.   #WinWidth = 800
  5.   #Number_of_flakes = 10
  6. EndEnumeration
  7.  
  8. Structure SnowPosition
  9. X.i
  10. Y.i
  11. EndStructure
  12.  
  13. Dim Snow.SnowPosition(#Number_of_flakes)
  14.  
  15. For i=0 To #Number_of_flakes
  16.   Snow(i)\X = Random(800)
  17.   Snow(i)\Y = Random(600)
  18. Next
  19.  
  20. UsePNGImageDecoder()
  21. InitKeyboard()
  22. InitSprite()
  23.  
  24.  
  25. OpenWindow(0, 0, 0, 800, 600, "Static Sprite Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  26. OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0) ;Set the window parameters
  27. Global Quit.b = #False
  28. LoadSprite(#Flake, "flake.png", #PB_Sprite_Texture | #PB_Sprite_AlphaBlending)
  29.  
  30. Repeat
  31.    
  32.     Repeat
  33.         Event = WindowEvent()
  34.         If Event = #PB_Event_CloseWindow : Quit = #True : EndIf
  35.     Until Event = 0
  36.     FlipBuffers()
  37.     ClearScreen(0)
  38.     Gosub Snowflake
  39.     ExamineKeyboard()
  40.     Delay(5)
  41. Until KeyboardPushed(#PB_Key_Escape) Or Quit
  42. End  
  43.  
  44. Snowflake:
  45. For count=0 To #Number_of_flakes
  46.   DisplayTransparentSprite(#Flake, Snow(count)\X, Snow(count)\Y)
  47. Next count
  48. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement