for some reason a part of my first post is missing, I'll try to repost it
So you are talking about learning AS3, but you want AS2? You should be more specific. The code goes like this.
onEnterFrame=function(){
actions like
*myGravityEngine(_root.myHero)
*myGravityEngine(_root.myEnnemy1)
*myWindEngine(_root.myHero)
*myWindEngine(_root.myEnnemy1)
// The following code is somewhat more advance so don't feel bad if don't understand right away,
// take it one step at the time
// you can also use a for loop to go throught an array of every objects is affected by physic
// var arrObjects:Array=Array(_root.myHero,_roo t.myEnnemy1)
// add as many ennemy or other object as you like
// for(i=0;i<arrObjects._lenght+1;i++){
// a for loop is like an if statment that run multiple in one frame time until the condition returns false
// in our case until we run all the objects in the array.
// myGravityEngine(arrObject[i])
// myWindEngine(arrObject[i])
//}
}
*here are a couple of other things you might want to know
How to have your code seperated in reusable functions (one function can be apply to many objects), arg1 stand for argument you can have as much as you want you just need to specify th type (mine is MovieClip). When naming a function be concise and wright it in one word using capital letters instead of spaces, my gravity engine becomes myGravityEngine
function myGravityEngine(arg1:MovieClip){
if(!_root.ground.hitTest(arg1)){arg1._y+
+}
}
var wind:Boolean=true; // this is how you declare variable by the way, usually at the top of your script
var windSpeed:Number=3;
function myWindEngine(arg1:MovieClip){
if(wind){arg1._x-=windSpeed}
// notice here that if(wind==true) can be reduce to if(wind) to check for false you use if(!wind)
}
this is how you use mc's as buttons
_root.myMC.onRollOver=function{action} // when mouse is over myMC but not clicking
_root.myMC.onRollOut=function{action} //when mouse is no longer over myMC
_root.myMC.onPress=function{action}// when you click on it
_root.myMC.onRelease=function{action}// when you release your click over myMC
_root.myMC.onReleaseOutside=function{act ion} // when you release your click outside myMC
onClipEvent(onLoad){action}
is
onLoad=function(){action}
Hope this help.