2013-05-22 6 views
-1

Я программирование игры с мячом в Adobe Flash, Javascript 3 и я получаю ошибку в строке 113 (последняя строка), который говорит:Adobe Flash Game Программирование

1087: Syntax error: extra characters found after end of program.

package 
{ 
import flash.display.MovieClip 
import flash.text.TextField 
import flash.events.Event 
import flash.events.MouseEvent 

public class DocumentMain extends MovieClip 
{ 
    public const GRAVITY:Number = 2; 
    public const BOUNCE_FACTOR:Number = 0.8; 

    public var _bounces:TextField; 
    public var _highscore:TextField; 
    public var _ball:Ball; 

    private var _vx:Number; 
    private var _vy:Number; 


    public function DocumentMain():void 
    { 
     _vx = 10; 
     _vy = 0; 

     _ball.buttonMode = true; 

     addEventListener(Event.ENTER_FRAME, enterFrameHandler); 
     addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); 
    } 

    private function enterFrameHandler(e:Event):void 
    { 
     // gravitate the ball 
     _vy += GRAVITY; 

     // move the ball 
     _ball.x += _vx; 
     _ball.y += _vy; 

     // check boundaries for collusion 
     checkBoundaryCollisions(); 
    } 

    private function mouseDownHandler(e:MouseEvent):void 
    { 
     //hit the ball if it has been clicked 
     if (e.target == _ball) 
     { 
      hit(e.target.mouseX, e.target.mouseY); 
     } 
    } 
    private function checkBoundaryCollisions():void 
    { 
     var left:Number; 
     var right:Number; 
     var bottom:Number; 
     var top:Number; 

     left = _ball.x - (_ball.width/2); 
     right = _ball.x + (_ball.width/2); 
     bottom = _ball.y + (_ball.height/2); 
     top = _ball.y - (_ball.height/2); 

     if (left < 0 && _vx < 0) 
     { 
      _ball.x = _ball.width/2; 
      _vx *= -1; 
     } 
     else if (right > stage.stageWidth && _vx > 0) 
     { 
      _ball.x = stage.stageWidth - (_ball.width/2); 
      _vx *= -1; 
     } 
     if (top < 0 && _vy < 0) 
     { 
      _ball.y = _ball.height/2; 
      _vy *= -1; 
     } 
     else if (bottom > stage.stageHeight && _vy > 0) 
     { 
      _ball.y = stage.stageHeight - (_ball.height/2); 
      _vy *= -BOUNCE_FACTOR; 
      _vx *= BOUNCE_FACTOR; 

      if (Number(_bounces.text) > Number(_highscore.text)) 
      { 
       _highscore.text = _bounce.text; 
      } 
      _bounces.text = "0"; 
     } 
    } 

    private function hit(hitX:Number, hitY:Number):void 
    { 
     //increment bounces 
     _bounces.text = String.(Number(_bounces.text) + 1); 
     //adjust the vertical velocity of the ball 
     if (_vy > 0) 
     { 
      _vy *= -BOUNCE_FACTOR/2 ; 
     } 
      _vy -= HIT_FORCE; 

     //adjust the horizontaly velocity of the ball 
     if (_vx * hitX > 0) 
     { 
      _vx *= -BOUNCE_FACTOR; 
     } 

      _vx -= (2 * hitX/_ball.width) * HIT_FORCE; 
     } 
     } 
     } 
     } 

ответ

0

избавиться от последняя фигурная скобка}. У вас слишком много в конце файла. Я также думаю, что вы имеете в виду Actionscript 3.

+0

Я попытался избавиться от символа}, но ошибка все еще существует :(, но если вы подсчитаете} и {вы увидите, что есть еще один один из них и дайте мне actioncript 3 :), но спасибо в любом случае: D – user2409136

+0

Я следовал этому учебнику http://www.youtube.com/watch?v=28qCfn2lS6o – user2409136

Смежные вопросы