Posts: 1,033
Threads: 59
Joined: Oct 2011
Reputation:
0
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 :]
Posts: 173
Threads: 7
Joined: Jan 2013
Reputation:
0
Thank you, Ghosty. This will come in handy for a Solar System project.
[spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] ɥɔǝǝʌpuɐs ǝʞıן ı ıoq ɥɐǝʎ [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler]
Posts: 173
Threads: 7
Joined: Jan 2013
Reputation:
0
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.
[spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] ɥɔǝǝʌpuɐs ǝʞıן ı ıoq ɥɐǝʎ [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler]
Posts: 173
Threads: 7
Joined: Jan 2013
Reputation:
0
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.
[spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] [spoiler] ɥɔǝǝʌpuɐs ǝʞıן ı ıoq ɥɐǝʎ [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler] [/spoiler]