The Powder Toy
Download
Forum
Browse
Wiki
FAQ
Play online
Register
Login
Discussions
/
Help
/
Idea:Ball lightning
«
1
»
Idea:Ball lightning
lcj4617
5th Feb 2012
Member
0
Permalink
The following paragraph copy it into Notepad file, save the file extension of "Ball lightning.lua" in the powder toy game directory:
tpt.el.elec.menusection=3
tpt.el.elec.color=0x9555ff
tpt.el.elec.description="Ball Lightning. Travels in strait lines and bounces of solids. It electrifies conductors. Explodes when Life=1."
tpt.el.elec.name="BLLT"
math.randomseed(os.time())
function ball_lightning(i,x,y,s,n)
if tpt.get_property("tmp",i)==0 then
tpt.set_property("life",math.random(50,150),i)
tpt.set_property("tmp",1,i)
end
for n = 1,50 do
xoff=math.random(-7,7)
yoff=math.sqrt((49)-(xoff^2))
if tpt.get_property("type",x+xoff,y+yoff)==0 then
tpt.create(x+xoff,y+yoff,"ligh")
tpt.set_property("life",4,x+xoff,y+yoff)
tpt.set_property("tmp",math.atan2(-yoff,xoff)/3.14159*180,x+xoff,y+yoff)
tpt.set_property("tmp2",1,x+xoff,y+yoff)
end
if tpt.get_property("type",x-xoff,y-yoff)==0 then
tpt.create(x-xoff,y-yoff,"ligh")
tpt.set_property("life",4,x-xoff,y-yoff)
tpt.set_property("tmp",math.atan2(yoff,-xoff)/3.14159*180,x-xoff,y-yoff)
tpt.set_property("tmp2",1,x-xoff,y-yoff)
end
end
if tpt.get_property("life",i)==1 then
for yoff=-38,38 do
for xoff=-math.sqrt((38^2)-(yoff^2)),math.sqrt((38^2)-(yoff^2)) do
if (x+xoff)>3 and (x+xoff)<608 and (y+yoff)>3 and (y+yoff)<380 then
if tpt.get_property("type",x+xoff,y+yoff)==0 then
tpt.create(x+xoff,y+yoff,"plsm")
tpt.set_property("life",30,x+xoff,y+yoff)
tpt.set_pressure((x+xoff)/4,(y+yoff)/4,1,1,10)
end
end
end
end
tpt.delete(i)
end
end
Then, open the the powder toy, open the the powder toy Lua controller, input: dofile (" Ball lightning.lua" ).
Then open the the powder toy explosives menu, find a name for the "BLLT" something, this is Ball lightning.
Edited once by lcj4617. Last:
15th Jun 2019
watereye
5th Feb 2012
Member
0
Permalink
I think this has already made.
https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=12391
lcj4617
5th Feb 2012
Member
0
Permalink
@watereye
(View Post)
I don not know!
sorry!
plead-for-destruction
5th Feb 2012
Member
0
Permalink
@lcj4617
(View Post)
wrong forum section....
Videogamer555
18th May 2012
Member
0
Permalink
This guy stole my idea. It's the same as mine, down to every last line of code!
https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=12391
«
1
»