Animation of Coin going out a Crate?

Hello, i have a Crate in my game… i’d like that When Player press E the chest will open and i can see an “animation” of the coin starting from the crate and going up in a specified point of the Sky… only if coin is not moving player can take it… Is that possible?

For now i did: At begin of scene coin is hide and then when Player hits E the coin will be shown and the Crate’s opening animation will be played…

You could do that yep. There are probably a few different ways. I think you just need a single variable.

You could place a (hidden) object on the scene where you want the coin to move to. Then as an action, select the Coin and “add a force to move to a object” (move the coin to the hidden object).

Then you trigger a scene variable, lets call it CoinMove for now.
“Coin is in Collision with your hidden object”… change variable CoinMove = 1

On your player/coin collision event, you can set a condition “Scene variable CoinMove=1”. So while the coin is moving, the variable is 0, the player cant collide with it. But once the coin collides with the hidden object, the variable changes to 1, and so the Player is now able to collide with the coin and get it. There are other ways you could achieve that effect too.

1 Like

Hey mate! Thanks for reply… it works “good” but not good at all i think i have some problems with Variables, Do you have Discord so we may talk there? =)

I’m not on Discord… Post your coin-related events here and describe the issue…

You probably know already but using Windows Snipping Tool you can just snip an image and then paste it straight into a reply (no need to save/upload)

Personaggio = Player
Baule = Crate
Moneta = Coin
MonetaTrasparenza = hidden object

I’ll be great if you edit this and re-send since it is working not very good

You didn’t use any variables at all in that one, instead it looks like you’re trying to stop the player from moving until the coin gets to the hidden object? When you say it’s not working good, can you describe the problem that’s happening? Also, do you have an event “player is in collision with coin”?

Yes i have that coin event.
What i did in my prev code is probably wrong also because i didnt use any variables, but yes, you have understood very well what i need in your first reply, but i have no idea how to apply them…:frowning_face:

(Scene Variable Coin i use for show a Coin in GUI each time the user collect it)

Ok that variable setup is all wrong… zip your game folder and upload it here… then i’ll take screenshot of the right code and send it back…

Is it secure? Maybe someone will download it XD?

Fun little game, doing a nice job so far :)…

So now when the player touches the chest there are 2 other coins flying to the coin from the side of the screen. Is that what you want? Or do you just want one coin to come out of the chest, then when it reaches the hidden object, the player is able to collect it? Do you want the player movement to stop until the coin reached the hidden object (like you have now), or want the player to still able to move but not be able to get the coin until it reaches the hidden object?

Thank you mate! =D
I just want one coin to come out from the chest, others coins must stay at their places.
And if possible i’d like the player to still able to move but cant get the coin until it reaches the hidden object

Should work ok now, check the link mate… One thing I forgot to mention is that I’ve made it so that you can’t get the money from the chest or any of the other money, until the coin has reached the hidden object. If you want the player to still be able to get the other money during that time, then just delete the CoinMove variable on the event for Moneta >

1 Like

Thanks mate! It’s solved now :slight_smile:

1 Like