Eng:How to Make Flying Sprites with Gravity

With the right backdrop and scripts, programming a sprite to "fly" may be fairly simple, but adding gravity helps with making platformers as well as jetpack games. The following script can help with the gravity implementation in a flying engine:

when green flag clicked forever if  then//You're flying glide (0.4) secs to: x: (x position) y: ((y position) + (40)) else//You're falling glide (0.4) secs to: x: (x position) y: (-110)

Or you can simply use Velocity:

when green flag clicked forever if  then change [Y Velocity v] by (0.1) else if <(Y Velocity) > (-8)>//Maximum falling speed change [Y Velocity v] by (-0.1)//Gravity end if  then //A ground sprite set [Y Velocity v] to (0) end end change y by (Y Velocity)

Example Projects
The following projects are examples of the above or a similar engine:
 * http://scratch.mit.edu/projects/16777123/
 * http://scratch.mit.edu/projects/14875141/
 * http://scratch.mit.edu/projects/15598102/
 * http://scratch.mit.edu/projects/16156895/