Thursday, May 10, 2012

[Action Script] Multiple problems with my target game. May,2012

Right now I'm working on a project for my flash class. I'm doing a game where you have 3 baseballs, each named ball1_mc, ball2_mc, or ball3_mc. I am getting an error starting on line 79 saying "1084: Syntax error: expecting identifier before logicaland". I can't figure this out. Also, when I ran the game before getting this error, I couldn't get the ball to stay in its home until clicked or drop when the mouse is released, completely breaking the game. Here is my code so far:

ActionScript Code: import flash.events.MouseEvent;import flash.events.Event;var startThrow1:Boolean = false;var startThrow2:Boolean = false;var startThrow3:Boolean = false;var holdBall1:Boolean = false;var holdBall2:Boolean = false;var holdBall3:Boolean = false;var rand:Number = 1; var score:Number = 0;Object(this).ball1_mc.buttonMode = true;Object(this).ball2_mc.buttonMode = true;Object(this).ball3_mc.buttonMode = true;Object(this).ball1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupBall1);Object(this).ball2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupBall2);Object(this).ball3_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupBall3);Object(this).ball1_mc.addEventListener(MouseEvent.MOUSE_UP, throwBall1);Object(this).ball2_mc.addEventListener(MouseEvent.MOUSE_UP, throwBall2);Object(this).ball3_mc.addEventListener(MouseEvent.MOUSE_UP, throwBall3);function pickupBall1(myEvent:MouseEvent):void{    holdBall1 = true;    startThrow1 = true;    var rand = (Math.floor(Math.random()*3 + 0));}function pickupBall2(myEvent:MouseEvent):void{    holdBall2 = true;    startThrow2 = true;    var rand = (Math.floor(Math.random()*3 + 0));}function pickupBall3(myEvent:MouseEvent):void{    holdBall3 = true;    startThrow3 = true;    var rand = (Math.floor(Math.random()*3 + 0));}function throwBall1(myEvent:MouseEvent):void{    holdBall1 = false;}function throwBall2(myEvent:MouseEvent):void{    holdBall2 = false;}function throwBall3(myEvent:MouseEvent):void{    holdBall3 = false;}stage.addEventListener(Event.ENTER_FRAME, carryBallAround);function carryBallAround (myEvent:Event):void{    if (holdBall1 == true)    {        Object(this).ball1_mc.x = mouseX;        Object(this).ball1_mc.y = mouseY;    }    else if (startThrow1 == true)    {        if(Object(this).ball1_mc.y<280)        {            Object(this).ball1_mc.y +=5;            Object(this).ball1_mc.x +=rand;        }        else        {            if(this.hoop5_mc.hitTestObject(Object(this).ball1_mc)) && hit = false;            {                hit = true;                score += 5;                Object(this).score_txt.text = score;            }            if(this.hoop10_mc.hitTestObject(Object(this).ball1_mc)) && hit = false;            {                hit = true;                score += 10;                Object(this).score_txt.text = score;            }            if(this.hoop25_mc.hitTestObject(Object(this).ball1_mc)) && hit = false;            {                hit = true;                score += 25;                Object(this).score_txt.text = score;            }        }    }        if (holdBall2 == true)    {        Object(this).ball2_mc.x = mouseX;        Object(this).ball2_mc.y = mouseY;    }    else if (startThrow2 == true)    {        if(Object(this).ball2_mc.y<280)        {            Object(this).ball2_mc.y +=5;            Object(this).ball2_mc.x +=rand;        }        else        {            if(this.hoop5_mc.hitTestObject(Object(this).ball2_mc)) && hit = false;            {                hit = true;                score += 5;                Object(this).score_txt.text = score;            }            if(this.hoop10_mc.hitTestObject(Object(this).ball2_mc)) && hit = false;            {                hit = true;                score += 10;                Object(this).score_txt.text = score;            }            if(this.hoop25_mc.hitTestObject(Object(this).ball2_mc)) && hit = false;            {                hit = true;                score += 25;                Object(this).score_txt.text = score;            }    }        if (holdBall3 = true)    {        Object(this).ball3_mc.x = mouseX;        Object(this).ball3_mc.y = mouseY;    }    else if (startThrow3 == true)    {        if(Object(this).ball3_mc.y<280)        {            Object(this).ball3_mc.y +=5;            Object(this).ball3_mc.x +=rand;        }        else        {            if(this.hoop5_mc.hitTestObject(Object(this).ball3_mc)) && hit = false;            {                hit = true;                score += 5;                Object(this).score_txt.text = score;            }            if(this.hoop10_mc.hitTestObject(Object(this).ball3_mc)) && hit = false;            {                hit = true;                score += 10;                Object(this).score_txt.text = score;            }            if(this.hoop25_mc.hitTestObject(Object(this).ball3_mc)) && hit = false;            {                hit = true;                score += 25;                Object(this).score_txt.text = score;            }    }}
Multiple problems with my target game.

Related Post



0 comments: