Tutorials Home
What's New
Top Rated
Submit
myTutes
Random!
Simple Gravity
Author: GinjaNinja
| Website: http://www.freewebs.com/buttmaster4eva/ |
Make an MC of a ball and a platform. Call the platform's instance "floor". Apply this code to the ball MC:
onClipEvent(load){
velocity = 0
gravity = 2
friction = 0.01
}
onClipEvent(enterFrame){
velocity += gravity
velocity -= friction*velocity
_y += velocity
if(_y>_root.floor._y){
_y = _root.floor._y
velocity *= -0.9
}
}
(Make sure you place the ball over the platform because it is the platform which makes it bounce)
Thanx to a_slosh for sorting the code out for me!
| » Level Intermediate |
|
|
Added: : 2004-10-02
Rating: 7.45 Votes: 39
Hits: 1487
|
| » Author |
|
I am pretty good at flash saying that I have taught myself just about everything I know
|
| » Download |
|
Download the files used in this tutorial.
|
|
Download (0 kb)
|
|
Get conversion and unzipping tools
for PC and Mac here!
|
| » Forums |
|
More help? Search our boards for quick answers!
|
|
Please rate this tutorial, 10 is the top rating, you can also click the
comments link to read/write a review.
|
|
|