The example can be downloaded and compiled from this link:
https://dl.dropboxusercontent.com/u/14221897/files/ Experiments/FlameTest.zip
The source code of the example is as follows:
///////////////
// FUNCTIONS //
///////////////
proc/Rnd(N1,N2)
return N1 + (rand() * (N2-N1))
//////////////
// PARTICLE //
//////////////
particle
parent_type = /obj
blend_mode = BLEND_ADD
icon = 'icons20.dmi'
icon_state = "particle"
var
position_x = 100.00
position_y = 100.00
velocity_x = 0.00
velocity_y = 0.00
time = 60
New()
..()
loc = locate(1,1,1)
velocity_x = Rnd(-1,1)
velocity_y = Rnd(0,0.5)
return src
proc/Update()
..()
velocity_y *= 1.05
velocity_x *= 0.90
position_x += velocity_x
position_y += velocity_y
pixel_x = position_x
pixel_y = position_y
alpha = 255 * (time/60)
// The memory leak goes away when this section is commented out
var/matrix/m = transform
m.Turn(10*((60-time)/60))
m.Scale(0.995,0.995)
transform = m
// -------
time--
if (time <= 0)
del src
////////////
// CLIENT //
////////////
client
New()
_client = src
..()
///////////
// WORLD //
///////////
world
fps = 30
icon_size = 20
cache_lifespan = 0
New()
..()
_MainLoop()
var
list/
_list_particles = new/list(60)
client/
_client = null
_counter = 1
proc/_MainLoop()
set background = 1
spawn()
while(TRUE)
_Update()
sleep(world.tick_lag)
proc/_Update()
_list_particles[_counter] = new/particle
_counter++
if (_counter > 60)
_counter = 1
for (var/particle/p in _list_particles)
p.Update()