PyromaniaBB-1.bb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ; Pyromania demo by R.Cummings ([email protected])
  2. ; if you decide to use my animation of an explosion, please
  3. ; either give me credit where due, or let me know :)
  4. Const FPS=30
  5. Global boomtex,bangsprite,camera,count,pitch#,yaw#,roll#,d
  6. AppTitle "BLITZ3D PYROMANIA"
  7. HidePointer
  8. Type bang
  9. Field frame#,obj
  10. End Type
  11. d=16 ; size of explosion grid
  12. Include "start.bb"
  13. ;Graphics3D 640,480,16,3
  14. SetBuffer BackBuffer()
  15. boomtex=LoadAnimTexture("boomstrip.bmp",49,64,64,0,39)
  16. bangsprite=CreateSprite()
  17. EntityTexture bangsprite,boomtex,39
  18. EntityBlend bangsprite,3
  19. HideEntity bangsprite
  20. camera=CreateCamera()
  21. PositionEntity camera,0,0,0
  22. period=1000/FPS
  23. time=MilliSecs()-period
  24. While Not KeyHit(1)
  25. Repeat
  26. elapsed=MilliSecs()-time
  27. Until elapsed
  28. ticks=elapsed/period
  29. tween#=Float(elapsed Mod period)/Float(period)
  30. For k=1 To ticks
  31. time=time+period
  32. If k=ticks Then CaptureWorld
  33. UpdateGame()
  34. UpdateWorld
  35. Next
  36. RenderWorld tween
  37. Flip
  38. Wend
  39. End
  40. Function UpdateGame()
  41. pitch#=pitch#+.4
  42. yaw#=yaw#-.2
  43. roll#=roll#+.1
  44. RotateEntity camera,pitch#,yaw#,roll#
  45. For i=0 To Rnd(d)+20
  46. AddBang(Rnd(-d,d),Rnd(-d,d),Rnd(-d,d))
  47. Next
  48. UpdateBangs()
  49. End Function
  50. Function AddBang(x#,y#,z#)
  51. b.bang=New bang
  52. b\obj=CopyEntity(bangsprite)
  53. PositionEntity b\obj,x,y,z
  54. RotateSprite b\obj,Rnd(-20,20)
  55. ; EntityColor b\obj,Rnd(255),Rnd(255),Rnd(255)
  56. count=count+1
  57. End Function
  58. Function UpdateBangs()
  59. For b.bang=Each bang
  60. If b\frame#>38.5
  61. FreeEntity b\obj
  62. Delete b
  63. count=count-1
  64. Else
  65. EntityTexture b\obj,boomtex,b\frame#
  66. b\frame#=b\frame#+1
  67. EndIf
  68. Next
  69. End Function
  70. ; EntityTexture sprite,boomtex,Floor(frame)
  71. ; frame=(frame+.5)Mod 39