Jump to content
GreenSock

Vlad

Members
  • Posts

    14
  • Joined

  • Last visited

Vlad's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. It's just my opinion, but you shouldn't even have a loop appending moves in the first place. Here's how I'd handle that. On your level controller class, an update method was called every frame: public function update():void { // Update clock counters var currentTime:int = getTimer(); countdown += currentTime - lastTime; lastTime = currentTime; // If one second (1000ms) has passed, create a new creep and reset the countdown if (countdown > 1000 && nOfCreeps < maxCreeps) { myCreepsArray.push(new Creep()); countdown -= 1000; } } Your creep should have the following methods: public function Creep() { // Just move! nextStep(); } public function nextStep():void { // Every creep is independent, no need for loops if(nextX == 0) nextX = x; // This allows to have vertical movement only if(nextY == 0) nextY = y; // And this allows to have horizontal movement only myTween:TweenLite = TweenLite.to(this, time, { x:nextX, y:nextY, onComplete:nextStep } ); } This way, each creep is independent, you just a need a list of nextX and nextY. Putting a timeline in all the creeps and then controlling the time to make them move is seriously a bad idea for game development, not because of Timeline itself (which can be useful in this situation) but because you want to handle the code in a separate and modular way in order to keep everything in your control. What I'm saying is: game development wise, you should have the Tween lib classes controlling transitions, not logic.
  2. I think the 'offset' is a delay to make each creature start its movement at separate times. The problem is the logic. The creatures can (and maybe should) be created at once, but they start with an idle state, waiting to proceed, you can even use a tween to count the time but maybe that's a bit overboard. You can either set a timer (not that good idea) or check how much time has passed between frames, add that time to an internal counter and when enough time has passed, set the state of the creature to moving and create the first tween to the first location. After that, proceed as you are doing. If you do it like this, you can even have pathfinding with multiple paths. Timeline could help but it would take the flexibility of your game code. Is your multiplayer hotseat or server-side? This also matters.
  3. Tweenlite's static methods make pretty much all wrapping almost unnecessary. The biggest problem I found is that wrapping it usually means less functionality since hard-coding any of the possible parameters restricts the library. I'm wrapping TweenLite in our framework only in places where the same method can have different implementations. While I was at it, we got a contract that is interface dependent and using it directly is the fastest, most efficient and powerful option available. The only thing I have to worry about is to keep a FSM to control every object.
  4. First and foremost, I have to thank you for this wonderful library. Wrapping our object behaviors in it is working like a charm, everything is easy, works like a charm and we got a project that needs tweens back and forth and I'm amazed by the power and simplicity. New set of questions: A tween changes a numeric value overtime according to some easing function. Is it possible to get the delta between the last and the current values from the tween object? If not, I'll calculate it myself, but I need to know if the onUpdate function is called before or after the value is changed. I can quickly wrap up a solution for this, but I'm wondering what would be the best solution for something like this. Without using any Timeline object, is it possible to pause all the tweens of an object? Again... this is something easily coded but since performance is an issue, I'm wondering about the best possible strategies.
  5. Sorry but I'm 100% AS2 blind. You need to check what's the AS2 counterpart of mouseEnabled property.
  6. Assuming it's AS3, you can set mouseEnabled = false right before you start the tween. In the tween specify a onComplete function, sort of like this: TweenLite.to(this, 1, {bla bla bla, onComplete:myCompleteFunction}); On that function just put mouseEnabled = true; That should do it.
  7. An array with all the neighbors. When you trigger the event on the button to grow, call a method passing the current button as a parameter. In the function do something like... if(buttonPassed != buttonArray[buttonToTest]) buttonArray[buttonToTest].shrink() This is very... erm... untested to say the least, but it should get you running. Keep in mind that to make something very organic, a lot of tweaking is needed. The trick is to get the details just right.
  8. Hi Keep in mind that this is a general idea, I don't know how you have your project structured, but I would simply create mouse event listeners to mouse entering and leaving the button. The mouse would need to keep the instance of the tween created and null it when the tween finished. Idea is: 1. On mouse enter, check if tween exists, if so make it change direction, if not start a new tween to grow. 2. On mouse leave, check if tween exists, if so make it change direction, if not start a new tween to shrink. 3. On tween complete, null the tween variable. I'm not completely sure how to change the tween direction to be honest but I'm pretty sure it is possible.
  9. You could use a tween to run the movieclip's animation and trigger whatever method you need in the end of the tween. That way you would have control over the whole process.
  10. Let me dig into it first and I'll get back.
  11. With only one ease, I'll need multiple tween objects, which leads me to ask what happens when a tween is not active. I know what you mean about pools, but there's this one thing, called an Entity that has a bunch of objects in it. It's the only one I'm managing pools for and to make things worse it's also the one that will use more tween objects. Thanks for the taking your time, I appreciate it.
  12. Here I am again, now with more concrete questions. I'm using tweens mostly for behaviors. In the context of our framework a behavior is a functionality that affects both attributes of an object and its state. I'm wondering what would be the best approach to do manage the tweens. I'll use a simple object to explain, but keep in mind that other objects can be way more complex. I have a camera object that can zoom in/out and move along a map. Both of these behaviors are tweenable for 'the looks'! 1. Should I have have one tween to handle all the object's tweens considering that different behaviors can affect the same attributes, for instance, the camera zoom and movement act on x and y attributes. 2. Our framework allows object pooling. I seem to be able to reuse tweens easily, but can I expect any data to be saved in the tween that will give me some trouble late on? Or is there a clean way to reset a tween without creating a new one? I'll be back with more weirdness.
  13. Let me give you the perspective from the other side: some people, like me, didn't dare to pick AS2 because it was just not up to the standard. Actually (although I find this a strange elistist atittude) some coders still think AS3 is sub-par. AS3 now follows a standard and it is in fact a fantastic scripting language. The problem is AS2 gave a lot of power by being just permissive. AS3 gives more power, but you have to do it properly. I believe the issue is the moving from one to the other. I hope all goes fine with your project and that time will help you get used to a more strict yet better way of coding.
  14. Hi all, my name is Ricardo Vladimiro and I'm co-owner and programmer at Vortix Games Studio. We have a framework which we are building up as needed for our game development. While I was considering the reinvention of the wheel (read: coding our own tweening classes) I took a deep breath a read all the pages about GreenSock's Tweening Platform and the amount of good things I could do with it instead of melting my brain with our own tweening stuff makes me smile in antecipation. TweenLite with a bunch of plug-ins seems to be the weapon of choice to our framework, but I think I would have to manage a bunch of tweens individually with overwrite set to NONE. That is not a big deal since the framework is modular, but it raises some doubts. 1. Let's say I create a tween to move an object from x1,y1 to x2,y2. In the middle of path I want to move it to x3,y3 (from the current position), do I have to kill the previous tween or is there a way of changing the current one? My question is regarding object creation, mostly because of performance, so is there a way of restarting the current tween with new values? 2. More or less in the same line of thought, would it be possible to have a tween for acceleration that was active while a key is pressed? Imagine a car game where up arrow is your gas pedal. It would accelerate with key down and apply friction with the key up. I'll start implementing it on our framework's behaviors soon, so more doubts will pop-up, but for now, these come to mind. Thanks for the platform and keep up the good work! Vlad
×