Questions on delays and positions

Does defold offer a delay function to hold things in place for a few seconds?
And for the “go.set_position()” I’ve seen no examples that shows what would go in the parenthesis aside from a math expression. I want an object to return to a desired position with a x and y measurement.
Can I get some help?

For delays, you might want to take a look into the extension Timer, or any of the links referred to therein. I am not entirely sure what you mean by delay otherwise - could you clarify?

go.set_position() is supposed to take a math expression, as per the reference at game object reference - what else would you want it to do? If you want to animate its position (i.e. make it move smoothly, or anything else you can imagine), you might want to take a look at property animation, and specifically at easing.

I am not entirely sure what you mean by ‘I want an object to return to a desired position with a x and y measurement’. Do you mean that you are trying to use go.set_position(), but it is not working? It is hard to tell what the solution will be without knowing what you have tried.

One possible solution would be to use go.animate() with a delay and duration. If you want to set a position after a certain amount of time has elapsed then set a delay of the time to wait and duration to zero.

Thanks so much, the timer is working great.
Sorry, I thought that maybe you could have something like go.set_position(560, 970, 0)

Sorry, I thought that maybe you could have something like go.set_position(560, 970, 0)

Well, you do. The format for that is

go.set_position(vmath.vector3(560,970,0))

go.set_position is a function that only takes one parameter, so you have to bundle up your three coordinates into a single object - that’s what the vector3 object does for you.

Edit: Ah, well, go.set_position() can actually take two values; a vector3 and a game object ID.

Yes, like this:

go.set_position(vmath.vector3(560, 970, 0))

The API docs mention that the first and only required parameter needs to be a vector3

1 Like

Man, don’t I look like a complete dumb, thanks guys and keep doing what your doing.

2 Likes

Not at all - that’s what the forums are for (and, of course, the excellent API docs)!

2 Likes