![]() |
Partially-complete gravity well script! - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: 2DWorlds Discussion (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=10) +--- Thread: Partially-complete gravity well script! (/showthread.php?tid=673) Pages:
1
2
|
RE: Partially-complete gravity well script! - Ghosty - 03-10-2013 You'd have to set a limit on how far away the part is from the gravity source. This could be done in about 3 lines of code, actually. This might not work perfectly, since my math skills are weak at best, but, basically, I think it would work like this: add one line to the top of the script: gravradius = 50 then, add after this bit: local xdist = gravitypoint.x - object.Position.x local ydist = gravitypoint.y - object.Position.y --new stuff local totaldist = math.sqrt((xdist * xdist) + (ydist * ydist)) --pythagorean theorem :] if totaldist < gravradius then -- do rest of script; just make sure to add an extra end :] RE: Partially-complete gravity well script! - Omega - 03-10-2013 Thank you, Ghosty. This will come in handy for a Solar System project. RE: Partially-complete gravity well script! - Oak - 03-10-2013 (03-10-2013, 01:39 PM)Omega Wrote: Thank you, Ghosty. This will come in handy for a Solar System project. Maelstronomer is already working on one too, you should message him. I may of spelled his username incorrectly though. Perhaps you should both do a collab project together? RE: Partially-complete gravity well script! - Omega - 03-10-2013 I hate collabs due to the fact that one person has a different idea (i.e someone says pluto isn't a planet and doesn't want to make it because they're lazy assholes) and then you get into a massive debate. I wouldn't mind making specific planets if he's going to make the entire solar system, however. RE: Partially-complete gravity well script! - Oak - 03-10-2013 (03-10-2013, 06:44 PM)Omega Wrote: I hate collabs due to the fact that one person has a different idea (i.e someone says pluto isn't a planet and doesn't want to make it because they're lazy assholes) and then you get into a massive debate. I wouldn't mind making specific planets if he's going to make the entire solar system, however. I like collab projects, but part of getting things done in them is cooperation and flexibility. RE: Partially-complete gravity well script! - Omega - 03-10-2013 I know, but it seems like every single person you work with wants to make a mirror opposite of what you wanted to make, so you end up making an enemy and not a game, so really that's why I don't like them. Then again, I don't like working with people on the spot either, we need basis and background and need to sketch out for a couple days before we start, but all collabs I've ever been with are made together in 15 minutes. |