When speed exceeds the width of the wall the clip moves outside...
Maybe you can adapt this...
Code:onClipEvent (load) { power = 1; yspeed = 0; xspeed = 0; friction = 0.95; gravity = 0.1; thrust = 0.75; radius = 10; xnew = _x; ynew = _y; xmin = _root.world1_1_walls._x + radius; xmax = _root.world1_1_walls._x + _root.world1_1_walls._width - radius; ymin = _root.world1_1_walls._y + radius; ymax = _root.world1_1_walls._y + _root.world1_1_walls._height - radius; } onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { xspeed -= power; } if (Key.isDown(Key.RIGHT)) { xspeed += power; } if (Key.isDown(Key.UP)) { yspeed -= power * thrust; } if (Key.isDown(Key.DOWN)) { yspeed += power * thrust; } xspeed *= friction; yspeed += gravity; xnew += xspeed; ynew += yspeed; if (Key.isDown(Key.SPACE)) { _root.player.player_beaming.gotoAndStop(2); } else { _root.player.player_beaming.gotoAndStop(1); } xnew = Math.min(xmax, Math.max(xmin, xnew)); _x = xnew; ynew = Math.min(ymax, Math.max(ymin, ynew)); _y = ynew; }




Reply With Quote