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

#1 2012-10-17 20:51:11

oshe10
Scratcher
Registered: 2012-06-21
Posts: 92

Gravity

How do you make gravity?
Can someone help, please?


http://i.imgur.com/w4rS6.jpg

Offline

 

#2 2012-10-17 21:08:07

oshe10
Scratcher
Registered: 2012-06-21
Posts: 92

Re: Gravity

Da!


http://i.imgur.com/w4rS6.jpg

Offline

 

#3 2012-10-17 21:36:11

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

Re: Gravity

If you want a better script, you'll have to be more specific.

when gf clicked
set [y velocity v] to (0)
forever
change [y velocity v] by ((-1)*(strength of gravity))
change y by (y velocity)


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

Offline

 

#4 2012-10-17 21:55:57

oshe10
Scratcher
Registered: 2012-06-21
Posts: 92

Re: Gravity

Thanks









!!!


http://i.imgur.com/w4rS6.jpg

Offline

 

#5 2012-10-17 22:16:27

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Gravity

This project explains it fairly easily:

http://scratch.mit.edu/projects/archmage/72848

or, if you don't like that one, try this one:

http://scratch.mit.edu/projects/Paddle2SeeFixIt/681997


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#6 2012-10-18 02:02:06

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Gravity

http://scratch.mit.edu/forums/viewtopic … 8#p1117338 is for a more complicated version of gravity. There are some other scripts in the thread as well.  smile

Offline

 

#7 2012-10-18 06:09:23

naiad_diana
New Scratcher
Registered: 2012-10-17
Posts: 7

Re: Gravity

To let an object fall, just loop "change y by" -n statement.

when gf clicked
forever
   change y by [3]
end

Offline

 

#8 2012-10-18 07:08:16

rlojunior
Scratcher
Registered: 2010-08-11
Posts: 59

Re: Gravity

naiad_diana wrote:

To let an object fall, just loop "change y by" -n statement.

when gf clicked
forever
   change y by [3]
end

It doesn't work as gravity script.
This script works to show a sprite going down at constant velocity.
When you want to add gravity the velocity have to be increased by an acceleration.
I mean, the y position wouldn't change by the same rate.

Bye

Offline

 

Board footer