Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function moveLR(d:String):void
- {
- var direction:int = GameConstants.moveAmount;
- if (!moving) {
- snd.play();
- moving = true;
- }
- // Which direction are we moving?
- if (d == "Left")
- {
- direction *= -1;
- }
- physicallyMove(direction);
- }
- private function physicallyMove(amount:int):void
- {
- if (side == "Left")
- {
- if (this.x < 70)
- {
- this.x = 70;
- }
- else if (this.x > (GameConstants.wallLeft - GameConstants.cannonWidth))
- {
- this.x = GameConstants.wallLeft - GameConstants.cannonWidth;
- }
- else {
- this.x += amount;
- this.assetWheel.play();
- }
- }
- else if (side == "Right")
- {
- if (this.x > 1210)
- {
- this.x = 1210;
- }
- else if (this.x < (GameConstants.wallRight + GameConstants.cannonWidth))
- {
- this.x = GameConstants.wallRight + GameConstants.cannonWidth;
- }
- else {
- this.x += amount;
- this.assetWheel.play();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement