Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

iloveaphextwin

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by iloveaphextwin

  1. I tried the span option first, but for some reason on Chrome sometimes the page would load with a couple of extra line breaks.
  2. Ok thank you very much. I assumed reduceWhiteSpace would avoid this browser issue but I guess its just for managing how splitText actually splits text. thanks again
  3. Thanks for your help but I'm just getting confused now. What I am saying is that in the HTML above i have a good 20 spaces and one   I would expect the word "YOUR" to be halfway across the page. However its only shifted a little bit to the right, and indeed without the   there is almost no extra gap beyond one single space. So to me it looks like reduceWhiteSpace false is not working, in that it is still reducing white space?
  4. It still doesn't really work properly. This only makes a small space. 30% OF &nbsp;YOUR<br>
  5. Hi there, I am having an issue with reduceWhiteSpace:false on splitText. It doesn't seem to be doing anything for spaces and or &nbsp; I have a font where placing a Y character next to another letter, with a space, it looks like there is no space between them. So I need to artificially add some space. I tried adding a span with margin but I was getting issues on some browsers so I need this reduceWhitespace to work. Thanks for your help Will
  6. Hi there, Any chance someone can fix the website. There seems to be some extra <br>'s in the html for some reason causing all the flash helpers to break. http://greensock.com/roughease https://greensock.com/customease https://greensock.com/timelinelite-as It's on lots of pages <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"<br /> id="fm_EaseVisualizer_759328311"<br /> class="flashmovie"<br /> width="550"<br /> height="540"> Thanks Will
  7. Hi Carl, I had a thought last night that it could be something to do with the overwrite settings on the tweens. If two tweens get fired, both of which are running doChecks onUpdate, then I can see how that might break it as they are both running over each other. Not sure how to check this. Were there any changes to the default overwrite settings between versions? Thanks
  8. Thanks. You can play last years one here. It's much more polished. http://www.williamjane.com/baublebash/
  9. Hi there, Really sorry, I had detailed what the problem was in the first PM but it got cut off when I sent it. If you take the file you have got working and repeatedly click as fast as you can right up again the borders, making it bounce off the side repeatedly or occasionally bauble, the game goes into a recursion loop and breaks. I saw the problem you mentioned before but republishing it removed any errors. Thanks Will
  10. 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.
  11. Hi there, I have seen many sites that let you smoothly scroll a webpage up and down when you click on navigation buttons. I was wondering how I would go about this with the new Greensock JS. I have had no luck, and also all the examples I have looked at scroll to the location of a div. Is there no way I can just set a value or height property instead. Like scrollTo 1000px. I already have my function set up so I just need the animate scroll code. $('#box1').click(function(){ // Code goes here }) Thanks for your help Will P.s. Sorry I just moved this post to here, realised I posted this in the wrong area of the forum before.
  12. Just for reference I have done exactly this here:- http://www.ourtestsite.org/antigravitysnowballgame/ It seems to work o.k. It simply looks for the collision and then kills all tweens and makes a new one using calculated angles. My problem now is that I need to be able to grab the speed of the apple at any point??? Thanks Will
  13. Hi there, I am working on a game that uses Greensocks Physics2d plug-in. I have the object being tweened rebounding off other objects. I need to be able to get the speed of the tweened movieclip at any time. Is there a way to do this that is not processor heavy. My tween looks like this:- TweenMax.to(ball, 20, {physics2D:{velocity:storeVelocity, angle:pingArrow._rotation, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); I set the velocity but obviously the speed decreases over time and depending on the angle it flies. Thanks Will
  14. Aww .. thanks man. That made my afternoon. I'll try the for loop thing it's a good point. As for the motion blur it doesn't seem to affect performance much at all really. I think the main reason it doesn't seem that smooth to me, is that this was based on another interactive banner I made where I did everything using Xspeed and Yspeed variables. These got updated on every frame adding the speed to the X and Y position. This seemed much smoother but I wanted to make my game using greensock as calculating the angle and velocities would have been a headache doing it the other way. (this probably makes no sense to anyone else) but describing the angle and velocity in a tween is much easier than calculating the angle using trigonometry. My main problem then is to do with the ball overlapping the pegs at points. I have seen normal hitTest code that would set the ball back to the right position on collision. This is easy when your object hits a horizontal plane but my pegs are round. So on collision I would have to work out the angle and then the maximum distance to move the ball so it was at the pegs edge. I'm not sure how to do this. Sorry if all this makes no sense at all. I'm in too deep now. Any more help is greatly appreciated. Thanks Will P.s. No I didn't make sucka swing.
  15. Erm .. I'm pretty sure Flash CS5 does a good job of exporting coded animations now?
  16. Hi there, I have made myself a little game loosely based on peggle. You can have a look here:- http://www.ourtestsite.org/antigravitysnowballgame/ Currently it uses Greensocks Physics2DPlugin and MotionBlurPlugin. It works o.k. but I would really appreciate anything you can spot that might make it run smoother. It also runs differently every time and sometimes the ball overlaps the pegs. I have the peg and boundary hit checks running using greensocks onUpdate feature but I'm not sure if this is the best way. Thanks for any help. If you manage to help make it smoother then you can feel free to use my code to make your own game but please don't copy it 100%. Any other comments are greatly appreciated. Will stop(); mainTL = this; import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; TweenPlugin.activate([Physics2DPlugin, MotionBlurPlugin]); //TweenPlugin.activate([Physics2DPlugin]); ball.cacheAsBitmap = true; // Variables var gravity:Number = 500; var totalPegs:Number = 15; var pegRadius:Number = 10; var ballRadius:Number = 20; // Constants var collisionRadius:Number = pegRadius + ballRadius; var leftBorder:Number = 0; var rightBorder:Number = Stage.width; var topBorder:Number = 0; var bottomBorder:Number = Stage.height + (ballRadius*2) + 20; var activePegs:Array = new Array(); var mBStrength:Number = 0.5; var mBQuality:Number = 0; var reboundVelocity:Number = 350; var dHitNum:Number = 0; var bNum:Number = 0; var lastSecSaveGot:Boolean = false; var gameStatus:String = "idle"; var mainScore:Number = 0; var myHighScore:Number = 0; var hitsNoClicks:Number = 0; var offTheWall:Boolean = false; // Initial setup clickArea._width = rightBorder; clickArea._height = bottomBorder; ballPlatform._y = 570; for(i=0; i activePegs[i] = mainTL["peg" + i]; mainTL["_level0." + i + "hit"] = false; } startAd(); function startAd() { getSharedData(); offScreenMarker._visible = false; TweenMax.killTweensOf(ball); ball._x = 500; ball._y = 544; ballRadius = 20; ball._xscale = 100; ball._yscale = 100; ball.hotSpot._xscale = 100; ball.hotSpot._yscale = 100; ball.snow_whirl._xscale = 100; ball.snow_whirl._yscale = 100; mainScore = 0; } function getSharedData() { ////////// user = SharedObject.getLocal("user_profile"); //user.clear(); if (user.data.score == undefined){ myHighScore = 0; myHighScore_txt.text = "High Score: " + myHighScore; } else { myHighScore = user.data.score; myHighScore_txt.text = "High Score: " + myHighScore; } } function saveSharedData() { user.data.score = mainScore; user.flush(); myHighScore_txt.text = "High Score: " + user.data.score; gotoAndStop('submit_score'); } // Ball interaction clickArea.onPress = function() { ballPressed = true; ballActive = false; } clickArea.onRelease = function() { if(gameStatus != "gameover"){ mainScore -= 100; if(gameStatus == "idle"){ TweenLite.to(ballPlatform, 1, {_y:620, ease:Quad.easeOut, overwrite:false}); } gameStatus = "active"; TweenMax.killTweensOf(ball); ballPressed = false; ballActive = true; hitsNoClicks = 0; offTheWall = false; if(ball._y > 640 && lastSecSaveGot == false){ lastSecSaveGot = true; drawBonus("lastSecondSave"); } var storeVelocity:Number = (getDistance(ball._x, ball._y, _xmouse, _ymouse))*2; if(storeVelocity <= 400){ storeVelocity = 400; } TweenMax.to(ball, 20, {physics2D:{velocity:storeVelocity, angle:pingArrow._rotation, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); } } function toDegrees(radians) :Number{ var degrees = radians * 180/Math.PI return degrees; } function getAngleOf(x1,y1,x2,y2):Number{ var dx = x2-x1; var dy = y2-y1; var angle = Math.atan2(dy,dx); return toDegrees(angle); } function getDistance(x1, y1, x2, y2) { xdist = Math.round(x1 - x2); ydist = Math.round(y1 - y2); distanceFromThis = Math.sqrt((xdist*xdist) + (ydist*ydist)); return distanceFromThis; } function drawPingArrow() { pingArrow._visible = true; pingArrow._x = ball._x; pingArrow._y = ball._y; pingArrow._rotation = getAngleOf(ball._x, ball._y, _xmouse, _ymouse); if(getDistance(ball._x, ball._y, _xmouse, _ymouse) <= 100){ pingArrow._xscale = getDistance(ball._x, ball._y, _xmouse, _ymouse); pingArrow._yscale = getDistance(ball._x, ball._y, _xmouse, _ymouse); } else { pingArrow._xscale = 100; pingArrow._yscale = 100; } } function hidePingArrow() { pingArrow._visible = false; pingBar._visible = false; } function ballDied() { ball._x = 200; //ball._y = } function checkBorders(){ if(ball._x >= rightBorder - ballRadius){ TweenMax.killTweensOf(ball); ball._x = (rightBorder - ballRadius)-4; offTheWall = true; //Bounce off TweenMax.to(ball, 20, {physics2D:{velocity:(reboundVelocity/2), angle:180, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); } else if (ball._x <= leftBorder + ballRadius){ TweenMax.killTweensOf(ball); ball._x = leftBorder + ballRadius; offTheWall = true; //Bounce off TweenMax.to(ball, 20, {physics2D:{velocity:(reboundVelocity/2), angle:0, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); } if(ball._y >= bottomBorder - ballRadius){ TweenMax.killTweensOf(ball); ball._y = bottomBorder - ballRadius; // Do death thing TweenMax.killTweensOf(ball); gameStatus = "gameover"; delete onEnterFrame; gameOver(); } } function checkHit(targetMc, pegNum){ if(getDistance(ball._x, ball._y, targetMc._x, targetMc._y) <= collisionRadius){ // Add 500 to scroe mainScore += 500; TweenMax.killTweensOf(ball); hitsNoClicks++; //TweenLite.to(ball.hotSpot, 1, {_xscale:"10", _yscale:"10", ease:Quad.easeOut, overwrite:false}); //TweenLite.to(ball.snow_whirl, 1, {_xscale:"10", _yscale:"10", ease:Quad.easeOut, overwrite:false}); mainTL[targetMc + "hit"] = true; // Remove deleted peg from array //trace(targetMc); activePegs.splice(pegNum, 1); // Explode peg targetMc.gotoAndPlay('explode'); if(hitsNoClicks >= 2){ drawHitGraphics(targetMc._x, targetMc._y, hitsNoClicks); } if(offTheWall == true){ offTheWall = false; drawBonus("offTheWall") mainScore += 500; } var hitAngle = getAngleOf(ball._x, ball._y, targetMc._x, targetMc._y); TweenMax.to(ball, 20, {physics2D:{velocity:reboundVelocity, angle:hitAngle - 180, gravity:gravity}, onUpdate:doChecks, motionBlur:{strength:mBStrength, quality:mBQuality}}); } } function doChecks(){ checkBorders(); for(i=0; i checkHit(activePegs[i], i); } } function drawHitGraphics(spawnX, spawnY, numHits) { //trace(spawnX); //trace(spawnY); attachMovie("hitGraphic" + numHits, "dHit" + dHitNum, mainTL.getNextHighestDepth()); mainTL["dHit" + dHitNum]._xscale = 1; mainTL["dHit" + dHitNum]._yscale = 1; mainTL["dHit" + dHitNum]._x = spawnX; mainTL["dHit" + dHitNum]._y = spawnY; TweenLite.to(mainTL["dHit" + dHitNum], 0.5, {_xscale:100, _yscale:100, ease:Elastic.easeOut, overwrite:false}); mainScore += (1000*(numHits*0.5)); TweenLite.to(mainTL["dHit" + dHitNum], 0.5, {_alpha:0, overwrite:false, delay:1.5, onComplete:deleteIt, onCompleteParams:[mainTL["dHit" + dHitNum]]}); dHitNum++; } function drawBonus(tBonus){ attachMovie(tBonus, "bClip" + bNum, mainTL.getNextHighestDepth()); mainTL["bClip" + bNum]._xscale = 1; mainTL["bClip" + bNum]._yscale = 1; if(tBonus == "lastSecondSave"){ mainTL["bClip" + bNum]._x = ball._x; mainTL["bClip" + bNum]._y = 570; } else if (tBonus == "offTheWall"){ mainTL["bClip" + bNum]._x = ball._x; mainTL["bClip" + bNum]._y = ball._y; } TweenLite.to(mainTL["bClip" + bNum], 0.5, {_xscale:100, _yscale:100, ease:Elastic.easeOut, overwrite:false}); TweenLite.to(mainTL["bClip" + bNum], 0.5, {_alpha:0, overwrite:false, delay:1.5, onComplete:deleteIt, onCompleteParams:[mainTL["bClip" + bNum]]}); bNum++; } function drawOffScreenMarker(){ offScreenMarker._x = ball._x offScreenMarker._visible = true; } function hideOffScreenMarker(){ offScreenMarker._visible = false; } function gameOver() { TweenMax.killTweensOf(gameOver2); attachMovie("gameOver", "gameOver2", mainTL.getNextHighestDepth()); gameOver2._yscale = 1; gameOver2._xscale = 1; gameOver2._x = 500; gameOver2._y = 300; TweenLite.to(gameOver2, 0.5, {_xscale:100, _yscale:100, ease:Elastic.easeOut, overwrite:false}); TweenLite.to(gameOver2, 0.5, {_alpha:0, overwrite:false, delay:1.5, onComplete:gameOverDone}); } function gameOverDone() { deleteIt(gameOver2); if(mainScore > myHighScore){ saveSharedData(); } else { gotoAndStop('low_score'); } } function deleteIt(dTarget) { //trace(dTarget); //trace("del it"); removeMovieClip(dTarget); } onEnterFrame = function(){ guide_hitsNoClicks.text = hitsNoClicks; collisionRadius = pegRadius + ballRadius; ballRadius = (ball.hotSpot._width/2); bottomBorder = Math.floor(Stage.height + (ballRadius*2) + 20); //trace(bottomBorder); mainScore_txt.text = "Score: " + mainScore; //guideArray.text = activePegs; // Draw ping arrow if(ballPressed == true){ drawPingArrow(); } else { hidePingArrow(); } if (ball._y <= topBorder + ballRadius){ drawOffScreenMarker(); } else { hideOffScreenMarker(); } }
×