
Код AS1/AS2:
maze.onEnterFrame=function() {
with (_root.player) {
// управляем скоростью для Player
mySpeed = 3;
// управляем расстоянием, на которое отскакивает Player от стены после удара
myBounce = 3;
// контролируем клавиатуру
if (Key.isDown(Key.DOWN)) {
this._y -= mySpeed;
}
if (Key.isDown(Key.UP)) {
this._y += mySpeed;
}
if (Key.isDown(Key.LEFT)) {
this._x += mySpeed;
}
if (Key.isDown(Key.RIGHT)) {
this._x -= mySpeed;
}
// определяем, соприкасаются ли края player со стенками walls лабиринта Maze
if (this.walls.hitTest(getBounds(_root).xMax, _y, true)) {
_x -= myBounce;
}
if (this.walls.hitTest(getBounds(_root).xMin, _y, true)) {
_x += myBounce;
}
if (this.walls.hitTest(_x, getBounds(_root).yMax, true)) {
_y -= myBounce;
}
if (this.walls.hitTest(_x, getBounds(_root).yMin, true)) {
_y += myBounce;
}
// проверяем, закончился ли лабиринт
if (_root.end.hitTest(_x, getBounds(_root).yMax, true)) {
_root.gotoAndStop(3);
}
}
}
и выставите 30fps, так лабиринт меньше дергаться будет