2DWorlds Forums
My bullet keeps respawning - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13)
+--- Thread: My bullet keeps respawning (/showthread.php?tid=6617)



My bullet keeps respawning - Duck - 07-07-2011

[lua]t = script.Parent

function FIREINTHEHOLE()
if game.World:getChild("Bullet") ~= nil then
game.World:getChild("Bullet"):remove()
end
script.Parent.Texture = "http://desmond.imageshack.us/Himg217/scaled.php?server=217&filename=guntexture0002.png&res=gal"
local e = t.Bullet:clone()
local R = t:getAngle()
e.Rotation = R - 90
e.Parent = game.World
sleep(0.3)
script.Parent.Texture = "http://desmond.imageshack.us/Himg59/scaled.php?server=59&filename=guntexture0001.png&res=gal"
sleep(4.7)
e:remove()
end

link(t.MouseDown, FIREINTHEHOLE)[/lua]


The bullet just keeps respawning every 5 seconds and it doesn't disappear when I MouseDown


RE: My bullet keeps respawning - noob007 - 07-07-2011

Dats cuz you just keep cloning a bullet and then after five seconds you destroy the clone.


RE: My bullet keeps respawning - Duck - 07-07-2011

But shouldn't it only clone my bullet when I MouseDown, rather than looping?


RE: My bullet keeps respawning - noob007 - 07-07-2011

When you mouse down, it clones it, waits five seconds and then removes it...


RE: My bullet keeps respawning - Dignity - 07-07-2011

Exactly.