Best option to move with easing (+request)

0 favourites
  • 14 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hi folks!

    I'm about to finish my game (must be 100% complete on Wednesday!) so now I'm working on the menus.

    I wanted the menu items - Logo, "Play", "About" - to enter the screen one at a time, and I wanted them to enter and decelerate when reaching their final position. I'm wondering what's the best way to do it! What do you guys think?

    Also, I'd like to propose a "Move To" behavior, where you could enter the destination coordinates for the sprite, along with the period and the type of easing, and it would go there. I've seen this being added on all major game frameworks (Flash, Unity and Cocos2d, for example) and it helps A LOT. Would that be possible - or even discussable?

    I once had to find the easing formulas when a friend of mine was trying to implement, so I have them right here: http://www.robertpenner.com/easing/

    And you can check the types of easing here: http://hosted.zeh.com.br/mctween/animationtypes.html

    Cheers!

  • I used in my menus, things like mouse over(wait 1sec) mouse not over. Active animation.

  • Hmmmm I'm not sure I follow you... What do you mean by that?

    When I come back home from work I'm gonna try the custom movement behavior...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can customize your sprite paths as well, just make a group of codes and the conditions with the formulas.

    All of that paths can be done by this way.

    Start doing simple paths like circles, updating the path every tick, and keep it doing ellipses, etc.

    The formulas you said you have. So, post a formula here and, if necessary, I can help you doing a sample.

    Oh, and also, if it's not your problem, Yeah, it'll be great.

  • +>object.variable =1

    -> object set x to lerp(object.x,destinationx,0.5*dt)

  • +>object.variable =1

    -> object set x to lerp(object.x,destinationx,0.5*dt)

    Wow! I totally forgot about the LERP! Thanks Newt!

    Still, ain't the Move To a good idea? <img src="smileys/smiley2.gif" border="0" align="middle" />

  • I think rex rainbow did such a behavior.

    Check the "Plugins for C2" forum.

  • excuse, but what is LERP? and where we Can learn more about this Easter eggs?

  • [excuse, but what is LERP? and where we Can learn more about this Easter eggs?

    thank for this question.<img src="smileys/smiley42.gif" border="0" align="middle" /> I asked myself the same. <img src="smileys/smiley29.gif" border="0" align="middle" />

  • You can find more about LERP:HERE

    Wow, didn't know about the Move To plugin!

    I have to start lurking around that section! Thanks Kyatric!

  • Thank you <img src="smileys/smiley1.gif" border="0" align="middle" />

    I can't open the exemple file, because I can't install CC .

    Is there a exemple for C2 too ?

  • Lerp is a very simple function

    Lerp stands for Linear intERPolation

    This function need 3 numbers parameter

    lerp(a,b,t)

    a and b are whatever number you want

    but t goes from 0 to 1 (well it can go under and over but... let's keep things simple)

    lerp(a,b,0) returns a

    learp(a,b,1) returns b

    the values in between 0 and 1 returns a number X between a and b such as X-a = (b-a)*t

    so t describe more or less where you are in between a and b

    lerp(a,b,0.5) return the middle so a+(b-a)/2

    lerp(0,10,0) = 0

    lerp(0,10,1) = 10

    lerp(0,10,0.5) = 5

    the way newt use it with

    sprite set X to lerp(self.X,destination,0.5*dt)[/code:3849wyf8] is a little trick
    the .X you have in the lerp is the .X you change in the expression
    and 0.5*dt is always more or less the same (depending on fps)
    
    so from step to step in the movement, destination-self.X will be shorter and shorter, so the lerp(self.X,destination,0.5*dt) will continue to move the sprite but slower and slower (ease out)
    
    In short the only issue with this technique is that the sprite will takes time to exactly get to destination. Mathematically it should never arrive but thanks to float rounding stuff it will.
    Anyway you should not rely too much on
    if sprite.X = destination
    
    that's all
  • Thank you for your explanation! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Yann, I somehow missed your explanation of lerp. Thanks for taking the time to explain it so well.

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