This is my event:

How can I loop it so that goes from Origin to Destination back to Origin, and so on?

I know the variables work, because if I only use one of those, the object travels from it's current position to the variable coordinates.

This is my event:

How can I loop it so that goes from Origin to Destination back to Origin, and so on?

I know the variables work, because if I only use one of those, the object travels from it's current position to the variable coordinates.

This is why back and forth movement is often done via collision checks with marker objects set at the two positions, as collisions test a range of values around a position.

1. Start point

2. End point

3. Percentage between the two points (0.0 - 1.0 where 0.5 is right in the middle between the two points)

Should be easier to calculate than using forces.

Wendigo wrote:You could also use the "Lerp" expression (linear interpolation) for movement between two points. Unfortunately the description of the function doesn't tell very much. It takes three arguments:

1. Start point

2. End point

3. Percentage between the two points (0.0 - 1.0 where 0.5 is right in the middle between the two points)

Should be easier to calculate than using forces.

Thanks for the suggestion, which event should I be using for this? I can't find any movement/position conditions that take those three arguments

I can't find any movement/position conditions that take those three arguments

It would be an action, but anyway it's not an action, "lerp" is an expression that you have to use in the action to set position, it works this way:

"lerp(A, B, X)" returns a value between A and B in function of X, if X = 0 it returns A, if X = 1 returns B, if 0 < X < 1 it will return a value between A and B. For example for A = 1, B = 2 and X = 0.5 returns 1.5, and for X = 0.8 returns 1.8.

I guess you can use X < 0 or X > 1 to get values out of the range A-B. For example for A = 1, B = 2 and X = 3, it would return 4. If the lerp function doesn't accept such values (X < 0 or X > 1) you can use your own function: "A + X*(B - A)".

I have an example here using the lerp function to move back and forth between two points:

Hope it helps

I should be studying now :/

Lizard-13 wrote:I have an example here using the lerp function to move back and forward between two points:

Hope it helps

Thanks for the example! However, I tried to open it in GDevelop 4 (the latest non-beta v5 version), and got a warning that the example was created with a newer version. I opened up the events and it was blank.

I then tried to open it in GDevelop 5, but it only allows you to open JSON files - would you be able to send is as a JSON instead? (Assuming you're using v5)

I should be studying now :/

Hi I am having a lot of trouble having to go in an[…]

Seventh Screeny! Its already Christmas and the shi[…]

I've deleted the duplicate, check the platform tem[…]

Alright i got it now,thanks guys,also didnt expect[…]

salut, 1/ change de navigateur 2/ sauvegarde ta v[…]

Aaah tu vas tellement vite, merci beaucoup :mrgree[…]

I've had another play around with the timers, and […]

And how the "Level1-Tutorial" scene eve[…]

That is no surprise, because "Rotate towards […]

Ok so I have been trying everything I can think of[…]

Sorry, I was using an unstable build version, I've[…]

GDevApp is the new awesome app to create games directly from your browser!