[Behavior] LiteTween

  • Zebbi

    You can set the object origin at the bottom of the sprite (via animation editor > set origin), any height scaling won't affect the sprite's position if you do it that way.

    Thanks, I've done that now. Would be to be able to select which origin to tween from, for example, I have some characters resizing their height as they walk (with the origin set to the bottom center), but when they jump and do a somersault, it would be nice if the rotational angle could be set from the centre, rather than the bottom centre, to make it look like a smooth spin.

  • Zebbi

    Oh, in that case, in construct 2, you can define different origin for every animation or even frame. So you can have center origin for the sommersault animation, while keep using bottom origin for the running, walking and crouching animation. LiteTween would always use the origin instead of ImagePoint, because it is only a behavior attached to something like sprite. The actual rotation is done by the official sprite plugin. It is possible to code LiteTween so that it would override how Sprite rotation behave, but I think it is not good if I override the default rotation provided.

  • Zebbi

    Oh, in that case, in construct 2, you can define different origin for every animation or even frame. So you can have center origin for the sommersault animation, while keep using bottom origin for the running, walking and crouching animation. LiteTween would always use the origin instead of ImagePoint, because it is only a behavior attached to something like sprite. The actual rotation is done by the official sprite plugin. It is possible to code LiteTween so that it would override how Sprite rotation behave, but I think it is not good if I override the default rotation provided.

    Yes, but if I change the origin point for the somersault, the character's animation position will jerk up when that plays, and back down again when it stops playing, won't it? I'm also just using the same walk animation at the moment for the somersault since you can't really see it's walking when it's rotating. Could there be a way of setting the origin point to image if needed?

  • Zebbi

    Ah, now i understand what your problem is. I have one trick that might work, without messing up with the javascript SDK, but it probably won't be a clean simple solution like you want. The trick would be making two sprite, and use one for the jumping 'tween' and the other for the height tween. I'll just post the example capx here, maybe you want to take a look.

    https://dl.dropboxusercontent.com/u/553 ... rigin.capx

  • Zebbi

    Ah, now i understand what your problem is. I have one trick that might work, without messing up with the javascript SDK, but it probably won't be a clean simple solution like you want. The trick would be making two sprite, and use one for the jumping 'tween' and the other for the height tween. I'll just post the example capx here, maybe you want to take a look.

    https://dl.dropboxusercontent.com/u/553 ... rigin.capx

    Thanks for that great example, that's a great trick using the opacity, I've got my enemies set-up with containers already so it'll be double the sprites I already have, but this will at least work! Would it screw up the SDK by having optional image points for a future version of litetween?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Zebbi

    It would be so much work and also, it will be a dirty hack to make litetween override the default rotation/angle caveat for all common plugins, even only for Sprite it is already alot of work >.<. I think it is really something that should not be implemented at behavior level.

  • Thanks for the plugin. This is awesome. I am now going through a tutorial that uses the old easetween pug. I see that the properties of easetween is different from litetween. For example, I don't have "Playback Mode" which has for example "Ping Pong Stop". What should I do to get the same effect? Thanks

  • mzeid

    First thing first, EaseTween's ping pong is different from LiteTween ping pong. So, easetween ping pong works by doing tween back and forth, while litetween pingpong reverse the seek bar of the tween. It is easier to differentiate if you see how they work in practice.

    Okay, now for the ping pong stop, you just use ping pong (accessible from the start action), and then add 'On Reverse End' Condition for the sprite (or anything you tween), then put action Sprite.LiteTween.Stop.

    In LiteTween you might end up taking more events to control your tween, but in the end, that is how it should be. EaseTween is more comfortable and powerful, but the idea of making LiteTween is to make is more light, and to delegate all the play control to the even sheet.

  • lunarray

    Thanks lunarray for your reply. I need to play more with both behaviors and see. Thanks again for taking the time to address my question. Appreciate it!

  • Thank You!!

  • Hi,

    I have an issue with LiteTween:

    If I click so the arrow will have to be between 180 and 360°, it makes one turn to the left (or more) instead of picking the shortest path.

    Any idea how I could always have the shortest path between the start and target angles?

  • The problem is with angle(), not LiteTween. Try: (angle(arrow.X,arrow.Y,mouse.X,mouse.Y)+360)%360

  • Thank you for your reply

    It doesn't always pick the short way between the two angles though

  • le Canapin

    I don't have time to test it yet, but i have a guess about it. Maybe it happened when the first angle is a bigger number than the target angle. For example, tweening from 245 to 15? It is better to add 360 to the 15 if the target value is bigger from the source value. Could you test it and tell me how it goes?

  • can you add screenshots ?

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)