//This code is written for an approximate framerate of 30fps //Flash MX code (actionscript) //The following code will detect keypresses from the user and execute commands accordingly if(_root.isAlive) { if(Key.isDown(Key.LEFT) && *ONLY LEFT*) { pac._xscale=-100; //Assuming the center point is in the exact center of the object pac._x-=5; //To move the object 5 pixels in the LEFT direction } if(Key.isDown(Key.RIGHT) && *ONLY RIGHT*) { pac._xscale=100; //Assuming the center point is in the exact center of the object pac._x+=5; //To move the object 5 pixels in the RIGHT direction } if(Key.isDown(Key.SHIFT) && ObjOnGround) { pacVelocityUp=10; } } //The following code is located in the pac object and will control various actions if(this._y==ground._y) //Assuming that pac._y is at the very BOTTOM of the pac object { ObjOnGround=true; } else if(this._y-11) { pacVelocityUp-=2; //so pac will actually go downwards with 'gravity' } } //The following code will be located inside all of the enemy objects objRad=20; //will vary for different enemies and if they ever transform... if(_root.pac.pacVelocityUp<0 && _root.pac._y<=(this._y+this._height)) { _root.pac.pacVelocityUp=4; //So pac goes up a bit after jumping on an enemy activeObj=false; //deactivate the enemy so pacman won't get hurt on it any more _root.score+=100; //add 100 points to the score gotoAndPlay("ouch"); //play the ouch animation for the current enemy } hyphyp=Maths.Sqrt(Math.pow((this._x-_root.pac._x), 2)+Math.pow((this._y-_root.pac._y), 2)); if(hyphyp