-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path13-Particle.sb
More file actions
83 lines (59 loc) · 2.03 KB
/
13-Particle.sb
File metadata and controls
83 lines (59 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
;Babylon.sbi - Particle System
EnableExplicit
IncludeFile "babylon/babylon.sbi"
Global Scene, Camera, Box, Emitter, Material
Declare LoadGame()
Declare RenderGame()
UseModule BJS
InitEngine(@LoadGame())
Procedure LoadGame()
Scene = CreateScene()
If Scene
CreateCamera("camera", 0, 10, 30, #BJS_ArcRotate)
CreateLight("light", 0, 10, 20)
;The particle system will be attached to a mesh
Box = CreateBox("box", 2, 2, 2)
;Create a particle system and attach it to a mesh.
Emitter = CreateParticleEmitter("particles", Box, 2000)
;Texture of each particle
ParticleTexture(Emitter, "data/textures/flare.png")
;Where the particles come from
ParticleEmitBox(Emitter, -1,1,1, 1,1,-1)
;Colors of all particles
ParticleColor(Emitter, RGBA(255, 0, 0, 255), RGBA(0, 0, 255, 255))
ParticleColorDead(Emitter, RGBA(0, 0, 55, 0))
;Size of each particle (random between...)
ParticleSizeRange(Emitter, 0.1, 0.5)
;Life time of each particle (random between...
ParticleTimeToLive(Emitter, 0.3, 1.5)
;Emission rate
ParticleEmissionRate(Emitter, 1000)
;Set the gravity of all particles
ParticleGravity(Emitter, 0, -9.81, 0)
;Direction of each particle after it has been emitted
ParticleDirection(Emitter, -7, 8, 7, 7, 8, -7)
;Angular speed
ParticleAngularSpeed(Emitter, 0, 360)
;Speed
ParticleSpeed(Emitter, 1, 3, 0.005)
;Start the particle system
StartParticle(Emitter)
RenderLoop(@RenderGame())
EndIf
EndProcedure
Procedure RenderGame()
RotateMesh(Box, 0.5, 0.5, 0, #PB_Relative)
RenderWorld()
EndProcedure
; IDE Options = SpiderBasic 2.20 (Windows - x86)
; CursorPosition = 28
; FirstLine = 8
; Folding = -
; WebAppName = particle
; HtmlFilename = particle.html
; JavaScriptFilename = particle.js
; JavaScriptPath = sb
; iOSAppOrientation = 0
; AndroidAppOrientation = 0
; EnableXP
; CompileSourceDirectory