Kod: Zaznacz cały
hero = _root.character;
s = 15;
b = _root.character.getBounds(_root.character);
function move(x, y) {
if (!_root.walls.hitTest(hero._x+x+b.xmin+1, hero._y+y+b.ymin+1, true)) {
if (!_root.walls.hitTest(hero._x+x+b.xmax-1, hero._y+y+b.ymin+1, true)) {
if (!_root.walls.hitTest(hero._x+x+b.xmin+1, hero._y+y+b.ymax-1, true)) {
if (!_root.walls.hitTest(hero._x+x+b.xmax-1, hero._y+y+b.ymax-1, true)) {
hero._x += x;
hero._y += y;
}
}
}
}
}
if (Key.isDown(Key.UP)) {
move(0, -s);
}
if (Key.isDown(Key.DOWN)) {
move(0, s);
}
if (Key.isDown(Key.LEFT)) {
move(-s, 0);
}
if (Key.isDown(Key.RIGHT)) {
move(s, 0);
}
