Search tutorials
Now that all the code is finished with, I guess some of you are wondering what some of it meant...
Explanation
if(facing ==0){
_xscale = 100;
}else{
_xscale = -100;
}
This AS detects a variable and changes which way the player faces accordingly.
if (Key.isDown(Key.LEFT)) {
facing = 1;
this.gotoAndStop(2);
if (_x <%lt%>= leftsensor) {
_root.BACKGROUND._x += bg4;
} else {
_x -= playerspd;
}
}
If the left key is down, then it'll set the direction of the player to one, making the player face left.
The player MC will also switch to the walking animation whenever the button's down.
If the player reaches a set border (determined by the 'scrolldistance' variable) then the foreground and background will move instead. The background is set as 'bg4', which mentioned earler is 'speed * 0.6;'
Understand? | » Level Intermediate |
|
Added: 2005-06-22 Rating: 6 Votes: 19 |
| » Author |
| Started actionscript at least a year ago - improving ever since! |
| » Download |
| Download the files used in this tutorial. |
| Download (7 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!