# Destroy door after collecting 10 coins

**URL:** <https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549>\
**Category:** Asset Creation\
**Tags:** UE4, question\
**Created:** [July 31, 2022, 9:18pm UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549 "2022-07-31T21:18:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![slycrespo2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/slycrespo2/32/561785_2.png) [@slycrespo2](https://forums.unrealengine.com/u/slycrespo2)\
**Post date:** [July 31, 2022, 9:18pm UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/1 "2022-07-31T21:18:28Z")

</div>

Hello!  
I am making a sidescroller game and I have a door mesh at the end of the level. I want the door to be destroyed after 10 coins are been collected. I also want to have a counter which shows how many coins the player currently has. Please somebody help me to do this.  
Thanks!

---

<div class="post-metadata">

**Author:** ![vespineauto007](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vespineauto007](https://forums.unrealengine.com/u/vespineauto007)\
**Post date:** [August 1, 2022, 1:31am UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/2 "2022-08-01T01:31:34Z")

</div>

Proposal… …the door can be referenced on the level BP. The amount of coins is a variable on the character. The character has a dispatcher function which say communicates the number of coins the character currently is carrying. The level BP binds to the character’s dispatcher at BeginPlay. The bound event on the level BP checks for the number of coins to be 10 or greater. When this happens either the door is destroyed or hidden from the game.

Thoughts?

---

<div class="post-metadata">

**Author:** ![56legion](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/56legion/32/1194529_2.png) [@56legion](https://forums.unrealengine.com/u/56legion)\
**Post date:** [August 1, 2022, 1:58am UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/3 "2022-08-01T01:58:18Z")

</div>

This is a huge topic to cover. First thing first, you need to apply the overlap event trigger, then UMG after that blueprint scripting (which comes first doesn’t matter). Each class need to be able to communicate with each other to send values.

---

<div class="post-metadata">

**Author:** ![slycrespo2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/slycrespo2/32/561785_2.png) [@slycrespo2](https://forums.unrealengine.com/u/slycrespo2)\
**Post date:** [August 1, 2022, 6:12am UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/4 "2022-08-01T06:12:02Z")

</div>

Thanks for reply, but it will be fine if someone attach a picture with nodes, because I am total beginner… I would be very thankful…

---

<div class="post-metadata">

**Author:** ![Quetzalcodename](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quetzalcodename](https://forums.unrealengine.com/u/Quetzalcodename)\
**Post date:** [August 1, 2022, 10:55am UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/5 "2022-08-01T10:55:33Z")

</div>

Hey @slycrespo2!

If you intend for this to only work in level, what you are looking for is blueprint communication. You will need a variable that can be updated with a function (number of coins) and of course your widget counter. Here is a non-Epic affiliated tutorial on blueprint communication through setting up a health bar that is the exact same concepts:

> [HTF do I? Blueprint to Blueprint Communication](https://youtu.be/6IOgkWv1lEY)

Total coins overall is similar but will require a persistent variable that transfers over all levels.

I hope the above solution works for you!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 1, 2022, 11:14am UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/6 "2022-08-01T11:14:43Z")

</div>

> attach a picture with nodes, because I am total beginner…

I’ll do you one better, have a look here:

> [@Crash Bandicoot collecting animation](https://forums.unrealengine.com/t/crash-bandicoot-collecting-animation/479908/2):
>
> I’ve created a small project to demonstrate one of the ways this could be handled: [[Image from Gyazo]](https://gyazo.com/dcb6c9f60771eb8daf4ade304f045512) Project link (v4.25): the player has a widget that represents their interface that interface widget has an additional (animation) canvas that we can shift elements in when the player collects an item, we create a widget that represents that item and add it to the above-mentioned canvas the player interface interpolates the location of the item widgets between starting location and another…

There is a project attached and the script you need to look into is in the Player blueprint. If this needs to work on a per-level basis, the script can be moved to the level blueprint instead - this will allow you to reference the door easily, for example:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/3/f/43fa4f48ac2aa7c7cea5d72ee6a5b525db8b5e57.png)

* * *

Namely:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/5/925d9cf7e2e2fc36332f4b054f5453d7c2c7492d.png)

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [August 1, 2022, 12:50pm UTC](https://forums.unrealengine.com/t/destroy-door-after-collecting-10-coins/618549/7 "2022-08-01T12:50:34Z")

</div>

i think there is dozens of great answers already, but I just wanted to say that this sort of thing is covered in many, many “beginner unreal tutorials” you can find all over the internet.

It is worth doing a couple because that will answer many questions that you don’t even know to ask yet. It’s a great way to jump start your learning. In the old days developers just had to learn everything through trial and error, which is powerful way to learn but slow.

With internet, now you can learn a ton from people who already figured out the basics, which can save you tons of time, so take advantage of it. As a beginner, try out lots of different tutorials, even if they are not seemingly related to exactly what you want to do.
