Since I got few time to upload new examples, here is now a particles example for use with EGSL 1.6.0
screen (1024,768,0,"Particles Engine Demo")
setframetimer (100)
size = 5
setparticlesize (size,"random")
--'instead of loading we are crating an image here
image = createimage (16,16)
startimagedraw(image)
backcolor (255,0,255)
cls()
color (255,255,0)
filltriangle (8,0,0,8,16,8)
color (255,0,0)
filltriangle (8,16,0,8,16,8)
sync()
stopimagedraw()
--'now set the image available for the particles but don't use it, yet
setparticleimage (image)
backcolor (0,0,0)
repeat
cls()
key=getkey()
if key == asc("1") then
resetparticles()
setparticletype("fillbox")
end
if key == asc("2") then
resetparticles()
setparticletype("fillcircle")
end
if key == asc("3") then
resetparticles()
setparticletype("box")
end
if key == asc("4") then
resetparticles()
setparticletype("circle")
end
if key == asc("5") then
--' of course the size doesn't matter here
resetparticles()
setparticletype("dot")
end
if key == asc ("6") then
resetparticles()
--' now use the image as particles
--' of course the colour values and size are useless with an image
setparticletype ("image")
end
if key==asc ("a") then
size = size + 1
setparticlesize (size,"random")
end
if key==asc ("b") then
size = size - 1
setparticlesize (size,"random")
end
if mouseb()==1 then
alphachannel (255)
createparticles (mousex(),mousey(),30,150,int(rnd()*255),int(rnd()*255),int(rnd()*255))
end
if mouseb()==4 then
alphachannel (125)
createparticles (mousex(),mousey(),30,150,int(rnd()*255),int(rnd()*255),int(rnd()*255))
end
updateparticles()
color (255,255,255)
drawtext (0,0,"1 - Fillbox Particles")
drawtext (0,10,"2 - Fillcircle Particles")
drawtext (0,20,"3 - Box Particles")
drawtext (0,30,"4 - Circle Particles")
drawtext (0,40,"5 - Dot Particles")
drawtext (0,50,"6 - Image Particles")
drawtext (0,60,"A - Increase Particles")
drawtext (0,70,"B - Decrease Particles")
drawtext (300,0,"Left mousebutton to draw")
drawtext (300,10,"Right mousebutton to draw alphachannel")
drawtext (300,20,"Particle Size: "..size)
sync()
until key==27
closewindow()