This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-07 16:52:38

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Need A Little Help...

Lets say i was trying to make a magnet, this may sound like a noobish question, but how would I make it so the closer it gets to another magnet(sprite2), it's velocity increases?


6418,

Offline

 

#2 2012-03-07 17:02:18

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Need A Little Help...

when gf clicked
forever
 set [Velocity v] to < (200) - (distance to [Magnet v]) >
end
Hope that helped!

You can toggle 200 also.

Last edited by ImagineIt (2012-03-07 17:03:15)

Offline

 

#3 2012-03-07 17:12:42

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Need A Little Help...

ImagineIt wrote:

when gf clicked
forever
 set [Velocity v] to < (200) - (distance to [Magnet v]) >
end
Hope that helped!

You can toggle 200 also.

Ah, thank you.  smile


6418,

Offline

 

#4 2012-03-07 17:38:35

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Need A Little Help...

Technically, the acceleration increases as it gets closer

I believe the equaction is something like this:
((charge of object1)*(charge of object2)/distance)/mass of object1 = acceleration of object1

Of course, there is a constant in there that you'll have to toy around with.  Having said that, you probably don't care about the change in acceleration xD.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer