|
|
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 <= 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?
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|