Coin movement when pick up

I’m learning to program and I made a runner from the tutorial.
How to make a coin fly to the corner of the screen when picking it up?

Thanks

1 Like

Hello!

This example might help you:

coin_magnet

If you are going for the effect of animating the node from world space (where coins are game objects) to screen space (gui), you might meet to transform the coordinates, but for Runner, the coins are going simply from a pickup position always to one place in the space, so I hope the example covers your use case :wink: If not, let us know!

I tried to implement from this example for a long time, but I didn’t succeed and I decided to write here to find out if there is another way to do this

1 Like

It looks to me you’d like to:

  1. Pick up, and remove, a coin in the game world
  2. Create an identical coin in a GUI scene
  3. Animate the coin from its starting position to the GUI counter top right
  4. Increment the counter

The tricky part is to convert the world position of the coin to a GUI (screen) position. If you use the Defold Orthographic extension camera, you can do it with:

I’m not sure if there is an example of this knocking about somewhere.

2 Likes

The animation done in this example looks a bit like the sketch you made:

Perhaps this is helpful to you?

2 Likes