Main.attacked = false
Main.step = 10
if (Main.hitTest(Wall)) {
Main._y -= Main.step;
} else if (Main.hitTest(Wall2)) {
Main._y += Main.step;
} else if (Main.hitTest(Wall3)) {
Main._x += Main.step;
}//makes sure it isn't touching a wall. I made the walls invisable and put the top wall at the height of the character when he is at the top of the floor
else if (Main.weakattack == false && Main.strongattack == false) {
if (Key.isDown(Key.RIGHT) && Main.attacked == false)//makes sure the character isn't attacked {
Main._xscale = Math.abs(Main._xscale)//flips the character to the other direction;
Main.stance = 1;
Main._x += Main.step; //he moves right at whatever Main.step is equal to
Main.gotoAndStop("Running");
} else if (Key.isDown(Key.LEFT) && Main.attacked == false) {
Main._xscale = -(Math.abs(Main._xscale));
Main.stance = 0;
Main._x -= Main.step;
Main.gotoAndStop("Running");
} else if (Key.isDown(Key.DOWN) && Main.attacked == false) {
Main._y += Main.step;
Main.gotoAndStop("Running");
} else if (Key.isDown(Key.UP) && Main.attacked == false) {
Main._y -= Main.step;
Main.gotoAndStop("Running");
} else if (!Key.isDown() && Main.attacked == false)//checks if all keys are released {
Main.gotoAndStop("still");
}//repeated without elses for diagonal walking
if (Main.hitTest(Wall)) {
Main._y -= Main.step;
} else if (Main.hitTest(Wall2)) {
Main._y += Main.step;
} else if (Main.hitTest(Wall3)) {
Main._x += Main.step;
} else if (Main.weakattack == false && Main.strongattack == false) {
if (Key.isDown(Key.RIGHT) && Main.attacked == false) {
Main._xscale = 60;
Main.stance = 1;
Main._x += Main.step;
Main.gotoAndStop("Running");
}
if (Key.isDown(Key.LEFT) && Main.attacked == false) {
Main._xscale = -60;
Main.stance = 0;
Main._x -= Main.step;
Main.gotoAndStop("Running");
}if (Key.isDown(Key.DOWN) && Main.attacked == false) {
Main._y += Main.step;
Main.gotoAndStop("Running");
}
if (Key.isDown(Key.UP) && Main.attacked == false) {
Main._y -= Main.step;
Main.gotoAndStop("Running");
}
}





--
--
Pointing out every little thing thats wrong with life is neither big nor clever. But it helps to pass the time.
--
Pointing out every little thing thats wrong with life is neither big nor clever. But it helps to pass the time.
Previous PageNext Page