heres a simple wall
- http://img106.echo.cx/my.php?image=walltest23xg.swf
on layer one, make a player image (a simple circle) make a mc, and give it the instance- player
layer 2, make a shape, any shape you wish, use a paintbrush, select it all. give it the instance - walls
input this script on to the walls-
onClipEvent (enterFrame) {
with (_root.player) {
mySpeed = 10;
myBounce = 10;
if (Key.isDown(Key.DOWN)) {
_y += mySpeed;
}
if (Key.isDown(Key.UP)) {
_y -= mySpeed;
}
if (Key.isDown(Key.LEFT)) {
_x -= mySpeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += mySpeed;
}
if (_root.walls.hitTest(getBounds(_root).xMax, _y, true)) {
_x -= myBounce;
}
if (_root.walls.hitTest(getBounds(_root).xMin, _y, true)) {
_x += myBounce;
}
if (_root.walls.hitTest(_x, getBounds(_root).yMax, true)) {
_y -= myBounce;
}
if (_root.walls.hitTest(_x, getBounds(_root).yMin, true)) {
_y += myBounce;
}
}
}