Intro, Question about property animations -> parabolic path

Hey there … pretty new to Defold, just jumped the Unity ship (got there from the Love2D boat) and I am really loving Defold! Here’s a GIF of my efforts at making a 2.5D action-adventure thing so far:

defold-si

I have many questions, but I’ll start with this one:

I am using go.animate to move my critters around (not the player, just the NPCs). At the moment if I want, for example, my octo-creature to take a flying leap at the player, I use two animations of the y-coordinate: one to leap into the air, the second to fall to the ground: the first uses EASING_INSINE to the apex of the parabolic path, then EASING_OUTSINE to accelerate back to the ground.

My question: is there a simple way to use just one animation to cover the entire parabolic path? I know I could use an INOUT easing and take the first derivative, I think … something like that. It may be obvious and I’m just missing it.

The method I’m using (two chained animations) is fine, I was just wondering if there was a simpler way.

Thanks!

I’m happy to be joining the Defold community! Definitely going to spread the word.

8 Likes

I am not sure if I understand correctly, have you tried to use go.PLAYBACK_ONCE_PING_PONG?

3 Likes

I have not, and I’m pretty sure that would work. I knew I was missing something simple. Just a straight linear move on the x, and a ping-pong from the ground to the apex on the y. Not sure why I didn’t think of that.

Excellent! I’ll give it a try, but I’m pretty sure that’s the solution.

Thank you!

3 Likes

Love what I’m seeing. Nice job!

Welcome to Defold!

3 Likes

The results (two lines of code! slick!):

splode

go.animate(url, "position.x", go.PLAYBACK_ONCE_FORWARD, pos.x+dx, go.EASING_LINEAR, speed, 0.0)
go.animate(url, "position.y", go.PLAYBACK_ONCE_PINGPONG, pos.y+dy, go.EASING_OUTSINE, speed, 0.0, die)

go.animate() is a gem.

Thanks again!

3 Likes