October 28, 2020, 05:29:03 AM

Author Topic: [bb] dragon fire by Afke [ 1+ years ago ]  (Read 1278 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] dragon fire by Afke [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
Title : dragon fire
Author : Afke
Posted : 1+ years ago

Description : the old dragon with fire effect

Code :
Code: BlitzBasic
  1. Graphics3D 800,600,32,1
  2. SetBuffer BackBuffer()
  3. enable=True
  4. vert=False
  5.  
  6. Global camera=CreateCamera ()
  7. ;environment cube
  8. cube=CreateCube ()
  9. FitMesh cube,-250,0,-250,500,500,500
  10. FlipMesh cube
  11. tex=LoadTexture( "D:Program FilesBlitz3Dsamplesmakdragonchorme-2.bmp" )
  12. ScaleTexture tex,1.0/3,1.0/3
  13. EntityTexture cube,tex
  14. EntityAlpha cube,.4
  15. EntityFX cube,1
  16.  
  17. ;floor mirror
  18. m=CreateMirror()
  19.  
  20. ;simple light
  21. light=CreateLight()
  22. TurnEntity light,45,45,0
  23. dragon=LoadMD2 ("D:Program FilesBlitz3Dsamplesmakdragonmodeldragon.md2 ")
  24. tex=LoadTexture("D:Program FilesBlitz3Dsamplesmakdragonmodeldragon.bmp")
  25. PositionEntity dragon,0,25,0
  26.  
  27. EntityTexture dragon,tex
  28. AnimateMD2 dragon,1,0.05,90,130
  29.  
  30.  
  31. ;camera
  32. camera=CreateCamera()
  33.  
  34. cam_xr#=30:cam_yr#=0:cam_zr#=0:cam_z#=-100
  35. ;--------------- fire--------------------
  36. pivFire=CreatePivot()
  37. Type fire
  38.         Field x#
  39.         Field y#
  40.         Field z#
  41.         Field alpha#
  42.         Field entity
  43.         Field scale#
  44. End Type
  45. sprite=LoadSprite("D:Igra Draculaspritefire.bmp",2,pivFire)
  46. PositionEntity sprite,3,20,43
  47. RotateEntity sprite,0,90,0
  48. HideEntity sprite
  49. con#=0.5:conx#=0.3:no=5
  50. Md=4
  51. ;----------------------------------------
  52. time=MilliSecs()
  53.  
  54.  
  55. While Not KeyDown(1)
  56. ;-------------- mod of fire------
  57.  
  58. If Md=1 Then
  59. a1=117:b1=122
  60. con#=1:conx#=0.8:no=5
  61. PositionEntity sprite,3,20,43
  62. RotateEntity sprite,0,90,0
  63.  
  64. End If
  65. If Md=2 Then
  66. a1=125 :b1=127
  67. con#=0.4:conx#=0.4:no=1
  68. PositionEntity sprite,-18,10,23
  69.  
  70. End If
  71. If Md=3 Then
  72. a1=100 :b1=102
  73. con#=0.4:conx#=0.3:no=3
  74. PositionEntity sprite,-3,3,33
  75.  
  76. End If
  77. If Md=4 Then
  78. a1=90 :b1=93
  79. con#=1:conx#=1:no=7
  80. PositionEntity sprite,10,15,43
  81. RotateEntity sprite,0,75,0
  82. End If
  83. ;--------------- fire --------------------
  84.         u=u+1
  85.         If u>360 Then u=1
  86.         Repeat
  87.                 elapsed=MilliSecs()-time
  88.         Until elapsed>0
  89.        
  90.         time=time+elapsed
  91.         dt#=elapsed*60.0/1000.0
  92.         anim=MD2AnimTime(dragon)
  93.         If anim>129 Then
  94.         Md=4
  95.         End If
  96.         If anim>93 And anim<100 Then
  97.         Md=3
  98.         End If
  99.         If anim>100  And anim<122 Then
  100.         Md=1
  101.         End If
  102.        
  103.  
  104.         If anim>122  And anim<127 Then
  105.         Md=2
  106.         End If
  107.  
  108.  
  109. If anim>a1 And anim<b1
  110. For i=1 To no
  111. f.fire=New fire
  112. falpha#=1;Rnd(0,1)
  113.  
  114. fscale#=con#*Rnd(8,12)
  115.  
  116. fentity=CopyEntity (sprite,piv1)
  117. SpriteViewMode fentity,1
  118. RotateSprite fentity,Rnd(360)
  119. num=mum+1
  120. Next
  121. End If
  122.  
  123. For f.fire=Each fire
  124.         falpha#=falpha#-0.02
  125.         ;fscale#=fscale#-Rnd(0.02,0.1)
  126.        
  127.                 If falpha>0
  128.                         EntityAlpha fentity,falpha
  129.                         If falpha#<0.4Then
  130.                         EntityColor fentity,80,200,150
  131.                         fx#=con#*conx#*3
  132.                         fy#=con#*Rnd(2.4,6.4)
  133.                         fz#=con#*Rnd(-4.8,4.8)
  134.                         ElseIf falpha#<0.8 And falpha#>0.4Then
  135.                         fscale#=con#*Rnd(10,14)
  136.                         fx#=con#*conx#*4;Rnd(1.9,2)
  137.                         fy#=con#*Rnd(-6,6)
  138.                         fz#=con#*Rnd(-6,6)
  139.                         Else
  140.                         fscale#=con#*4
  141.                         fx#=con#*conx#*Rnd(2,4)
  142.                         fy#=con#*Rnd(-2,2)
  143.                         fz#=con#*Rnd(-2,2)
  144.                 EndIf
  145.                         ScaleSprite fentity,fscale#,fscale#
  146.                         MoveEntity fentity,fx,fy,fz
  147.                        
  148.                 Else
  149.                         FreeEntity fentity
  150.                         Delete f
  151.                         num=num-1
  152.                 EndIf
  153. Next
  154. ;--------------------------------------------
  155. If KeyDown(17)WireFrame enable
  156. If KeyDown(203)
  157.                 cam_yr=cam_yr-2
  158.         Else If KeyDown(205)
  159.                 cam_yr=cam_yr+2
  160.         EndIf
  161.        
  162.         If KeyDown(200)
  163.                 cam_xr=cam_xr+2
  164.                 If cam_xr>90 cam_xr=90
  165.         Else If KeyDown(208)
  166.                 cam_xr=cam_xr-2
  167.                 If cam_xr<5 cam_xr=5
  168.         EndIf
  169.        
  170.         If KeyDown(26)
  171.                 cam_zr=cam_zr+2
  172.         Else If KeyDown(27)
  173.                 cam_zr=cam_zr-2
  174.         EndIf
  175.        
  176.         If KeyDown(30)
  177.                 cam_z=cam_z+1:If cam_z>-10 cam_z=-10
  178.         Else If KeyDown(44)
  179.                 cam_z=cam_z-1:If cam_z<-180 cam_z=-180
  180.         EndIf
  181.        
  182.         PositionEntity camera,0,0,0
  183.         RotateEntity camera,cam_xr,cam_yr,cam_zr
  184.         MoveEntity camera,0,0,cam_z
  185. If KeyDown(16) surf=GetSurface (dragon,1)
  186. If KeyDown(78) Then
  187. x=x+1
  188. If x>CountVertices (surf) Then x=CountVertices(surf)
  189. vert=True
  190. End If
  191. If vert=True Then
  192. VertexX(surf,x)
  193. VertexY(surf,x)
  194. VertexZ(surf,x)
  195. VertexColor surf,a,255,0,0,1
  196. EndIf
  197.  
  198. UpdateWorld
  199. RenderWorld
  200. Flip
  201.  
  202. Wend
  203. End


Comments :


Pedro(Posted 1+ years ago)

 Could you provide the texture :sprite=LoadSprite("D:Igra Draculaspritefire.bmp",2,pivFire)thanks:)


Afke(Posted 1+ years ago)

 you can use fire texture from exsample never mind it will be good


Barliesque(Posted 1+ years ago)

 Nice effect!I replaced the fire.bmp file with...C:Program FilesBlitz3DsamplesHi-ToroShooterShootergfxfire.bmp


Afke(Posted 1+ years ago)

 Ok man nice thanks for compliment


Rogue Vector(Posted 1+ years ago)

 add this line:EntityBlend fentity, 3It will look even more realistic.Rogue Vector


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal