Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Replace This
- for(var x:int = 0; x <= stage.stageWidth; x++) {;
- if (ship.hitTestPoint(x, 0, false)) {;
- ship.y += 1;
- ship.rotation += 1;
- }
- if (ship.hitTestPoint(x, stage.stageHeight, false)) {;
- ship.y -= 1;
- ship.rotation += 1;
- }
- }
- for(var y:int = 0; y < stage.stageHeight; y++) {;
- if (ship.hitTestPoint(0, y, false)) {;
- ship.x += 1;
- ship.rotation += 1;
- }
- if(ship.hitTestPoint(stage.stageWidth, y, false)) {
- ship.x -= 1;
- ship.rotation += 1;
- }
- }
- /// With this
- if ( ship.x - ship.width / 2 < 0 ) {
- ship.x = 0 + ship.width / 2;
- ship.rotation += 1;
- }
- if ( ship.x + ship.width / 2 > stage.stageWidth ) {
- ship.x = stage.stageWidth - ship.width / 2;
- ship.rotation += 1;
- }
- if ( ship.y - ship.height / 2 < 0 ) {
- ship.y = 0 + ship.height / 2;
- ship.rotation += 1;
- }
- if ( ship.y + ship.height / 2 > stage.stageHeight ) {
- ship.y = stage.stageHeight - ship.height / 2;
- ship.rotation += 1;
- }
Add Comment
Please, Sign In to add comment