2DWorlds Forums
10/14/10 #2 - Events - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: News (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=8)
+--- Thread: 10/14/10 #2 - Events (/showthread.php?tid=1075)



10/14/10 #2 - Events - Jacob__mybb_import1 - 10-15-2010

Events are now working (currently only Collided). This is how you use them:

Code:
link(script.Parent.Collided, function(h) h.Color = Color(math.random(0, 255), math.random(0, 255), math.random(0, 255)) end)

This will make the part the script is in a color changer.

When a script is removed, any events created from it are deactivated.

I will work on tools tomorrow.


RE: 10/14/10 #2 - Events - ptown2 - 10-16-2010

can you give atleast a small example on a oncollided script?

because the one that you have is a slight bit confusing


RE: 10/14/10 #2 - Events - Jacob__mybb_import1 - 10-16-2010

Use link(object.event, function) to connect an object's event to a function. The function should take 1 argument, which will be the other part it collided with.

Code:
link(script.Parent.Collided, function(h)
print(script.Parent.Name.." collided with "..h.Name)
end)