Guest User

Untitled

a guest
Apr 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// Replace This
  2.  
  3. for(var x:int = 0; x <= stage.stageWidth; x++) {;
  4.     if (ship.hitTestPoint(x, 0, false)) {;
  5.         ship.y += 1;
  6.         ship.rotation += 1;
  7.     }
  8.     if (ship.hitTestPoint(x, stage.stageHeight, false)) {;
  9.         ship.y -= 1;
  10.         ship.rotation += 1;
  11.     }
  12. }
  13. for(var y:int = 0; y < stage.stageHeight; y++) {;
  14.     if (ship.hitTestPoint(0, y, false)) {;
  15.         ship.x += 1;
  16.         ship.rotation += 1;
  17.     }
  18.     if(ship.hitTestPoint(stage.stageWidth, y, false))   {
  19.         ship.x -= 1;
  20.         ship.rotation += 1;
  21.     }
  22. }
  23.  
  24. /// With this
  25.  
  26. if ( ship.x - ship.width / 2 < 0 ) {
  27.     ship.x = 0 + ship.width / 2;
  28.     ship.rotation += 1;
  29. }
  30. if ( ship.x + ship.width / 2 > stage.stageWidth ) {
  31.     ship.x = stage.stageWidth - ship.width / 2;
  32.     ship.rotation += 1;
  33. }
  34. if ( ship.y - ship.height / 2 < 0 ) {
  35.     ship.y = 0 + ship.height / 2;
  36.     ship.rotation += 1;
  37. }
  38. if ( ship.y + ship.height / 2 > stage.stageHeight ) {
  39.     ship.y = stage.stageHeight - ship.height / 2;
  40.     ship.rotation += 1;
  41. }
Add Comment
Please, Sign In to add comment