Jump to content
Search Community

Search the Community

Showing results for tags 'v2'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

Found 1 result

  1. Hi there, I have a big problem with a game I am making a sequel for. After much frustration I have found that I can fix the problem by reverting to an earlier version of the GSAP scripts. The problem occurs when I try to perform many tweens or collision checks at once. The new Greensock gets stuck in a recursive loop. I think it might be something to do with having two tweens that run with an onUpdate function. I know this probably isn't enough information yet but please could someone help me get to the bottom of this problem. function checkHit(targetMc, pegNum){ if(getDistance(ball._x, ball._y, targetMc._x, targetMc._y) <= collisionRadius){ ballsHit++; hitsNoClicks++; // Add 500 to score addScore(500); // Remove deleted peg from array aP.splice(pegNum, 1); // Do ball spin var hitAngle = getAngleOf(ball._x, ball._y, targetMc._x, targetMc._y); var useAngle = Math.abs(hitAngle); var rotateAngle:Number; if(useAngle <= 90){ rotateAngle = Math.abs(useAngle-90)*-1; } else { rotateAngle = useAngle - 90; } // Speed limiter if(currSpeed >= maxReboundSpeed){ currSpeed = maxReboundSpeed; } /////////////// //// BONUS //// /////////////// // Check long shot if(getDistance(ball._x, ball._y, storeBallPosX, storeBallPosY) > longShotDistance){ drawBonus("longShot", targetMc._x, targetMc._y); storeBallPosX = ball._x; storeBallPosY = ball._y; } // Multi Hit call if(hitsNoClicks >= 2){ drawHitGraphics(targetMc._x, targetMc._y, hitsNoClicks); } if(offTheWall == true){ offTheWall = false; drawBonus("offTheWall", targetMc._x, targetMc._y) } /////////////// if(ballsHit == totalPegs){ // Check if last ball hit gameStatus = "endOfLEvel"; TweenMax.killTweensOf(ball); ball_splat._x = targetMc._x; ball_splat._y = targetMc._y; ball_splat.gotoAndPlay(2); ball.gotoAndPlay('explode'); playSplat(); //nextLevel(); // now set by splat ///////////////////// ////// PEG HIT ////// ///////////////////// } else { // Do normal ball hit TweenMax.killTweensOf(ball); playBbSmash(); TweenMax.to(ball, 20, {physics2D:{velocity:currSpeed*0.85, angle:hitAngle - 180, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); TweenMax.to(ball, 5, {_rotation:(rotateAngle * 25), ease:Quad.easeOut, overwrite:false}); } // No smash every time var randExplode:Number = random (3) +1; targetMc.gotoAndPlay("explode_" + randExplode); } } ///////////////////// //// BORDER HIT ///// ///////////////////// function checkBorders(){ if(ball._x >= rightBorder - ballRadius){ TweenMax.killTweensOf(ball); ball._x = (rightBorder - ballRadius) - edgeBuffer; offTheWall = true; //trace(currXVelocity); //Bounce off TweenMax.to(ball, 20, {physics2D:{velocity:currXVelocity*0.7, angle:180, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); TweenMax.to(ball, 5, {_rotation:-wallBounceAmount, ease:Quad.easeOut, overwrite:false}); } else if (ball._x <= leftBorder + ballRadius){ TweenMax.killTweensOf(ball); ball._x = leftBorder + ballRadius + edgeBuffer; offTheWall = true; //trace(currXVelocity); //Bounce off TweenMax.to(ball, 20, {physics2D:{velocity:currXVelocity*0.7, angle:0, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); TweenMax.to(ball, 5, {_rotation:wallBounceAmount, ease:Quad.easeOut, overwrite:false}); } if(ball._y >= bottomBorder - ballRadius){ //trace("checkit"); TweenMax.killTweensOf(ball); ball._y = bottomBorder - ballRadius - edgeBuffer; // Do death thing TweenMax.killTweensOf(ball); gameStatus = "gameover"; delete onEnterFrame; gameOver(); } } function doChecks(){ checkBorders(); for(i=0; i < aP.length; i++){ checkHit(aP[i], i); } } I think the problem code is in here somewhere. Thanks for any help you can give. I'm not sure how to find out which greensock versions they both are.
×
×
  • Create New...