Jump to content

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


  • Posts

  • Joined

  • Last visited

Artofacks1's Achievements


Newbie (1/14)



  1. Hello, I was wondering if there is any plans to integrate box2d type physics to the tween framework? After working hard to learn box2d for an IOS/Android game using Air. I kept wishing that I could just use this library.
  2. Thanks for your help once again, i also tried it with 60 frames per second and its silky smooth. Im developing this for an AIR android app so I need to test it on my evo4 now. Hopefully the phone can hold up with a higher frame rate. Thanks again!
  3. check this out, i added rotation to the tween and when it goes the first time it rotates, but when it puts the next set of three it doesn't. Thats another issue, but I'm wondering how many instances of the tween are being used and maybe that is why its slowing it down a bit?
  4. I tested this.. As you can see it is not calling the collision class and the tweens are still choppy. I added a zip so you can run and see that the tweens are still choppy. Thanks so much for your help. P.S. I am searching and reading as much as possible to see if I can fix the problem myself, but your expertise with the tween library is appreciated.
  5. Hi, Thanks for the help!!! The code is very clean and much more flexible. I have another question. I am seeing some lag with the tweens. They do not look smooth and look very jumpy. Is their anything I can do to smooth out the tweens so they are clean and fluid? I attached another sample with the new code. Thanks Again!
  6. None taken, I am happy to learn the correct way. Yes 3 is correct for this level, as the game gets harder I would like to ad more. It detects it the rock collided with the hero. Just a dumby, I will add it to the tween. I thought that would remove the Sprite/MovieCLip once the tween was complete. Yes it is attached! Thanks so much for your assistance.
  7. I got what i needed. I can add rocks to my game and check for hit detection. It runs fine for a bit than starts lagging. Plus I feel like a lot of duplicate code is used. Can the tweenlite gururs look at my code and suggest how i can use less duplicate code? import com.greensock.*; import com.greensock.easing.*; import flash.display.Sprite; import com.DetectCollision; var _rock:rock; var _rock2:rock2; var _rock3:rock3; var rockArray:Array = new Array(); var _hero:hero = new hero(); addChild(_hero); addRocks(1); addRocks(2); addRocks(3); function addRocks(num:*):void { trace(" : " + num); if (num == 1) { if (_rock) { removeChild(_rock); _rock = null; } _rock = new rock(); addChild(_rock); var randomYPosiion:Number = Math.round(Math.random() * stage.stageHeight - 50); _rock.x = stage.stageWidth; _rock.y = randomYPosiion; tweenRocks(_rock); } trace(" : " + num); if (num == 2) { if (_rock2) { removeChild(_rock2); _rock2 = null; } _rock2 = new rock2(); addChild(_rock2); _rock2.x = stage.stageWidth; var randomYPosiion2:Number = Math.round(Math.random() * stage.stageHeight - 50); _rock2.y = randomYPosiion2; tweenRocks(_rock2); } if (num == 3) { if (_rock3) { removeChild(_rock3); _rock3 = null; } _rock3 = new rock3(); addChild(_rock3); _rock3.x = stage.stageWidth; var randomYPosiion3:Number = Math.round(Math.random() * stage.stageHeight - 50); _rock3.y = randomYPosiion3; tweenRocks(_rock3); } } function tweenRocks(ob1:Sprite):void { var timeline:TimelineLite = new TimelineLite(); if (ob1 == _rock) { timeline.insert(new TweenLite (ob1, 5, {x:"-500", onUpdate:hitTest1, onComplete:addRocks, onCompleteParams:[1], autoRemoveChildren:true})); } if (ob1 == _rock2) { timeline.insert(new TweenLite (ob1, 5, {delay:3, x:"-500", onUpdate:hitTest2, onComplete:addRocks, onCompleteParams:[2], autoRemoveChildren:true})); } if (ob1 == _rock3) { timeline.insert(new TweenLite (ob1, 5, {delay:2, x:"-500", onUpdate:hitTest3, onComplete:addRocks, onCompleteParams:[3], autoRemoveChildren:true})); } } function hitTest1():void { _rock.rotation++; if (DetectCollision_C) { trace("_rock Detect"); DetectCollision_C = null; } var DetectCollision_C:DetectCollision = new DetectCollision(stage,_hero,_rock); } function hitTest2():void { _rock2.rotation++; if (DetectCollision_C) { DetectCollision_C = null; } var DetectCollision_C:DetectCollision = new DetectCollision(stage,_hero,_rock2); } function hitTest3():void { _rock3.rotation++; if (DetectCollision_C) { DetectCollision_C = null; } var DetectCollision_C:DetectCollision = new DetectCollision(stage,_hero,_rock3); }
  8. I am making a game that adds rocks to the stage. I cal the rocks(); function once so it gets one rock going, that i call the rockTimer(); which calls the rocks() function using the timer. However, when the rockTimer calls the rocks() to add another rock. It doesnt let the tween finish. What I want is the ability to add rocks at about 3 to 5 seconds apart. While keeping the same tween speed. So its like rocks flying across the screen that have multiple start times. Once the rock gets to the end it will remove itself. I tried multiple methods but cant seem to get it to work. Please help import com.greensock.*; import com.greensock.easing.*; import com.DetectCollision; var _hero:hero = new hero ; var _rock:rock=new rock ; var rockArr:Array = new Array(); function rocks(...rest):void { addChild(_hero); addChild(_rock); _rock.x = stage.stageWidth; //_rock.y = stage.stageHeight/2; //addChild(_rock); TweenLite.to(_rock, 7, {x:-10, ease:Linear.easeNone, onComplete:rocks,onUpdate:detectCollision, autoRemoveChildren:true}); } //var DetectCollision_C:DetectCollision = new DetectCollision(this, heroClip, rockClip); function detectCollision():void { //rocks(); var DetectCollision_C:DetectCollision = new DetectCollision(stage,_hero,_rock); } function rockTimer():void { trace("rockTimer"); var myTimer:Timer = new Timer(2000,1000); myTimer.addEventListener("timer", rocks); myTimer.start(); } rocks(); rockTimer();