Nuke, tornado/dustdevil, plane particle examples
Posted: Thu May 21, 2015 6:48 pm
Play with the affectors and change images...
Create these three folders inside a main folder:
texture, scripts, material.
Needs images named: smoke.png and ring_flare.png
Next save each of the scripts below to the scripts folder:
Filename: atombase.particle
Filename: atombase2.particle
Filename: atombloom.particle
Filename: atompillar.particle
Filename: atompillar2.particle
Oooops...Forgot the material script.
Save this in the material folder:
filename: materials.material
Here's the main code:
Create these three folders inside a main folder:
texture, scripts, material.
Needs images named: smoke.png and ring_flare.png
Next save each of the scripts below to the scripts folder:
Filename: atombase.particle
Code: Select all
particle_system atombase
{
quota 2000
material pbsmoke
particle_width 20
particle_height 20
cull_each false
renderer billboard
billboard_type point
emitter Ring
{
angle 110.7
colour 1 1 1 0.0729167
colour_range_start 1 1 1 0.0729167
colour_range_end 1 1 1 1
direction 0 1 0
emission_rate 183.4
position 0 0 -500
velocity 0
velocity_min 0
velocity_max 0
time_to_live 5
time_to_live_min 5
time_to_live_max 5
duration 0
duration_min 0
duration_max 0
repeat_delay 0
repeat_delay_min 0
repeat_delay_max 0
width 165.6
height 0
depth 10.17
inner_width 0.5
inner_height 0.5
}
}
Code: Select all
particle_system atombaseblast
{
quota 2000
material pbsmoke
particle_width 0.001
particle_height 0.001
cull_each false
renderer billboard
billboard_type point
emitter Ring
{
angle 11
colour 1 1 1 0.02
colour_range_start 1 1 1 0.07
colour_range_end 1 1 1 1
direction 0 0 1
emission_rate 683.4
position 0 0 -500
velocity 0
velocity_min 40
velocity_max 160
time_to_live 5
time_to_live_min 4
time_to_live_max 10
duration 0
duration_min 0
duration_max 0
repeat_delay 0
repeat_delay_min 0
repeat_delay_max 0
width 665.6
height 0
depth 60.17
inner_width 0.01
inner_height 0.01
}
affector Scaler
{
rate 20
}
}
Code: Select all
particle_system atombloom
{
quota 1000
material pbsmoke
particle_width 30
particle_height 30
cull_each false
renderer billboard
billboard_type point
emitter Ring
{
angle 110.7
colour 1 1 1 0.0729167
colour_range_start 1 1 1 1
colour_range_end 1 1 1 1
direction 0 -1 -1
emission_rate 163.4
position 0 100 -500
velocity 0
velocity_min 0
velocity_max 1
time_to_live 5
time_to_live_min 2
time_to_live_max 5
duration 0
duration_min 0
duration_max 0
repeat_delay 0
repeat_delay_min 0
repeat_delay_max 0
width 200
height 100
depth 15
inner_width 0.1
inner_height 0.1
}
affector Scaler
{
rate 7.049
}
affector ColourFader
{
red 1
green 0
blue 0
alpha 1
}
affector LinearForce
{
force_vector 0.1 -0.1 0
force_application add
}
}
Code: Select all
particle_system atompillar
{
quota 1000
material pbringflare
particle_width 15
particle_height 15
cull_each false
renderer billboard
billboard_type point
emitter Ellipsoid
{
angle 110.7
colour 1 1 1 0.0729167
colour_range_start 1 1 1 0.0229167
colour_range_end 1 1 1 0.0022167
direction 0 1 0
emission_rate 80
position 0 10 -400
velocity 0
velocity_min 0
velocity_max 0
time_to_live 3
time_to_live_min 2
time_to_live_max 5
duration 0
duration_min 0
duration_max 0
repeat_delay 0
repeat_delay_min 0
repeat_delay_max 0
width 4
height 4
depth 100
inner_width 0.1
inner_height 0.1
}
}
Code: Select all
particle_system atompillar2
{
quota 2000
material pbsmoke
particle_width 15
particle_height 15
cull_each false
renderer billboard
billboard_type point
emitter Ring
{
angle 410.7
colour 1 1 1 0.0729167
colour_range_start 1 1 1 0.0229167
colour_range_end 1 1 1 0.0022167
direction 0 -1 0
emission_rate 40
position 0 10 -400
velocity 0
velocity_min 3
velocity_max 8
time_to_live 5
time_to_live_min 5
time_to_live_max 5
duration 0
duration_min 0
duration_max 0
repeat_delay 0
repeat_delay_min 0
repeat_delay_max 0
width 4
height 4
depth 100
inner_width 0.9
inner_height 0.9
}
}
Oooops...Forgot the material script.
Save this in the material folder:
filename: materials.material
Code: Select all
material pbsmoke
{
technique
{
pass
{
lighting off
depth_write off
scene_blend alpha_blend
texture_unit
{
texture smoke.png
}
}
}
}
material pbringflare
{
technique
{
pass
{
lighting off
depth_write off
scene_blend add
texture_unit
{
texture ring_flare.png
}
}
}
}
Code: Select all
;Small and easy mini nuke example
;By DK_PETER
UsePNGImageDecoder()
UseJPEGImageDecoder()
InitEngine3D()
InitSprite()
InitKeyboard()
Global Dim par.i(6)
OpenWindow(0, 0, 0, 1024, 768, "Nuke", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 1024, 768, #False, 0, 0)
Add3DArchive("scripts", #PB_3DArchive_FileSystem)
Add3DArchive("material", #PB_3DArchive_FileSystem)
Add3DArchive("texture", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateCamera(0, 0, 0, 100, 100)
CameraBackColor(0, $001821)
MoveCamera(0, 0, 1, 0)
CameraDirection(0, 0, 0, -1)
CreateLight(0, $00FFDB, 0, 1000, 500, #PB_Light_Directional)
CreatePlane(0, 500, 500, 1, 1, 10, 10)
CreateTexture(0, 128, 128)
StartDrawing(TextureOutput(0))
Box(0, 0, 128, 128, $00668B)
For x = 0 To 500
Plot(Random(127,1), Random(127,1), $00759F)
Next x
StopDrawing()
CreateMaterial(0, TextureID(0))
CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0)
ScaleEntity(0, 100, 1, 100)
par(0) = GetScriptParticleEmitter(#PB_Any, "atombase")
par(1) = GetScriptParticleEmitter(#PB_Any, "atompillar")
par(2) = GetScriptParticleEmitter(#PB_Any, "atompillar2")
par(3) = GetScriptParticleEmitter(#PB_Any, "atombloom")
par(4) = GetScriptParticleEmitter(#PB_Any, "atombaseblast")
DisableParticleEmitter(par(0), #True)
DisableParticleEmitter(par(1), #True)
DisableParticleEmitter(par(2), #True)
DisableParticleEmitter(par(3), #True)
DisableParticleEmitter(par(4), #True)
CreateSprite(0, ScreenWidth(), ScreenHeight())
StartDrawing(SpriteOutput(0))
Box(0, 0, ScreenWidth(), ScreenHeight(), $FFFFFF)
StopDrawing()
Begin = ElapsedMilliseconds()
Repeat
Repeat : ev = WindowEvent() : If ev = #PB_Event_CloseWindow : Quit = 1 : EndIf : Until ev = 0
RenderWorld()
NowValue = ElapsedMilliseconds() - Begin
Select NowValue
Case 2000 To 2300
DisplayTransparentSprite(0, 0, 0, 255, $FFFFFF)
Case 2301 To 2550
DisplayTransparentSprite(0, 0, 0, 2550 - NowValue)
Case 2551 To 2620
DisableParticleEmitter(par(1), #False)
DisableParticleEmitter(par(2), #False)
Case 2621 To 2800
DisableParticleEmitter(par(0), #False)
Case 2801 To 3000
DisableParticleEmitter(par(3), #False)
Case 6001 To 6200
DisableParticleEmitter(par(4), #False)
Case 6600 To 6800
DisableParticleEmitter(par(0), #True)
DisableParticleEmitter(par(1), #True)
DisableParticleEmitter(par(2), #True)
DisableParticleEmitter(par(3), #True)
EndSelect
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1

