Ease in - out for start and stop character

  • #1, by TinTinSunday, 30. October 2016, 17:37 8 years ago
    Hi

    Is it possible character make a little ease in- out move for start and stop walking ?

    Forum Fan

    196 Posts


  • #2, by afrlmeSunday, 30. October 2016, 18:12 8 years ago
    You mean make them start & end slower than regular walk speed? Or do you mean you want to play a start & end walk animation on begin & end of walking?

    Multiple character outfits could be one way to go for sorting out the walk stuff or maybe multiple walk animations inside of the same outfit which you change between using the change character animation index value. Or if you are using the default sliding walk system, then you could adjust the characters walk speed, maybe with the Lua to() tweening function. Not really sure how you would sort out the speed of the ending walk animation with that as you would need a loop to listen out for when character is x distance from destination. But init walk would be easy enough as you could use a condition or something & insert the to() tween inside of the first frame of each walk animation or use a Loop to listen out for when character starts walking.

    game.CurrentCharacter.CurrentOutfit.OufitCharacterSpeed = 200 -- set initial speed value
    game.CurrentCharacter.CurrentOutfit:to(3000, {OutfitCharacterSpeed = 300}, easeQuintIn) -- change to 300 over 3 seconds.
    

    Imperator

    7278 Posts

  • #3, by TinTinMonday, 31. October 2016, 07:45 8 years ago
    Thanks for reply

    It's great that we can make anticipation for start walking and it's so useful for me.
    Actually I don't need to stop animation . I only want stop walking with a little far from destination ( It's one of 12 principles animation regular).
    So I want make stop or end slower than regular walk speed with 3 - 4 pixel far from main destination as slow in. like smooth scrolling.

    Forum Fan

    196 Posts

  • #4, by afrlmeMonday, 31. October 2016, 11:44 8 years ago
    Hmm... maybe you could create a loop that checks if characters current x or y position is less than or equal to x or y position of the destination. Please keep in mind that you would need at least 2 queries for destination as you would need to check if destination is an VisOBJ (player clicked on scene object or a character) or empty (player clicked on empty space) because there are multiple fields that handle the destination data...

    P.S: sorry but I don't have the time at the minute to go into more detail or provide an example, but long story short you would need to create an event listener using a mainLoop Lua event & inside of this you would listen out for when character state changes to walking & when that happens you would update a variable & change the walking speed of the character. Then you would listen out for when the player gets x or y pixels from the destination then use the to() function as I showed earlier to slow down the character with easing. Can't guarantee it would work though as I've never tried + I use update character position on each frame myself rather than the default slide system so character movement value doesn't affect the walking speed of my characters.

    Imperator

    7278 Posts

  • #5, by TinTinTuesday, 01. November 2016, 07:02 8 years ago
    Unfortunately I'm not good programmer yet special in Lua and I have to help by a programmer . I'll explain your guide to a programmer.

    Thanks a lot anyway

    Forum Fan

    196 Posts