How to make CoinBox

Can Anyone Please Tell me how to make an efficient CoinBox system Which gives me coins when hitted

I suggest that you use an event to detect the player’s collision with your block, then increases your coin variable by 1. To make it finite, give it a separate “empty” animation, and give it an object variable storing how many coins are in it. Each time it detects collision, it removes one coin from the box and gives it to the player. When it has 0 coins, it changes to its empty animation and stops giving the player coins.

But Bro if i want to make a object like coin above the coinbox and then the player has to collect the coin
Btw Thanks for reply and sorry for my english

Using an event to detect collision to the block would mean that the player can activate it just by colliding with it from any side. I would suggest you detect the player is in collision with the block from below if you want the Mario style.

Hey bro on youtube you have make a tutorial but that is only valid for one block
one year ago you said you will make again but this time it will be better
Plz make a video so i can understand and also other peoples

Oh, ok. Well for that you could have a condition where it creates a coin object at CoinBox.X(), CoinBox.Y()+10, or replace the ten with however up you need to coin to go. Then just use the above method of giving coins on collision, but for the new coin object.

but then i have to this for each coin box

Perhaps you could relate it to the closest object to the player, which would activate only the one the object is touching. I’m not completely sure, but I think there’s an action called pick closest object.

Here is what I have done, maybe you can adapt it to your needs. The name of my “Player” is Ozzy.

My Events are as follows:

The Object is as follows. It has three animations. The coin jumping up from the box is part of the animation.

The Object has a variable that I set to how many coins I want it to have before it gets empty:

To make it so it is only activated if hit from the bottom, I modified the hotbox as follows:

33%20AM

1 Like