Download

How to create a coin multiplier?

Hello everyone,

I am a student at staffordshire university and i am currently stuck on a bit of code for our game project.
Basically its an endless runner and i want to implement a “live shop”, which will double your coin (uranium in this case) pickups when purchased.

I have done 1 for speed but cant seem to do it for the coins… i will show you what i mean.
9d1fee64b2f6a2d83427fa6f32021d7b7506ba04.jpeg
b137ad1f84bee4e61742834ba97e0882f7a19118.jpeg
3ec31da773cdd351720346d2d327297f580baad9.jpeg
Screenshot4.jpg
Screenshot5.jpg

Thanks

Nitch

I am having a hard time understanding all of these variables you have setup. Why not just set TotalCoins to TotalCoins*2?

Because i want to be able to click on my shop and increment it which is why i made the increasecoins variable, I am reasonably new to blueprints, and we drew the short straw with our group and, ended up with no one who can code/bluepring, so i have taken it up as a task to get the BP working, aswell as i am trying to learn blueprints.
Basically the coins spawn on platforms randomly. you overlap them you get 1 coin, when you press pause, i have a shop, in the shop their is a button saying coin multiplier, i want to be able to click on that, and then when i overlap the coins i get 2 instead of 1, and if i were to do it 10 times then i would collect 11 at once etc.
If you have anything in mind, which you think will work please could you post a screenshot of some blueprint and a short explanation

I appreciate the feedback Jamendxman3

Thanks
Nitch

I still don’t understand what you do when you pause and why did you complicated the things so much.

If you have an item that you buy during the pause you get coin bonus?

Create a variable “has Uranium”. Make it a boolean. Set “has Uranium” based on some condition (for tutorial purpose make it that when you press a button, let’s say you bind button B).

Then before collecting coins you put a branch condition: has Uranium, yes or not. If has Uranium then coins increase x 2. If not (false) you live it as it was.

Basically, rather than having a shop with permanent upgrades, I want a shop which resets once you die, so you basically have to start again with no multiplier.
I have only been using BP’s for 2 months. I dont quite understand the binding command, I will have a look at some tutorials and will let you know whether i am successful or not.

“clear all boosts” and set all your variables to default again and call it upon spawn.

Managed to get it sorted, and added some other additional upgrades. You can see them on this video I made.
[video]https://youtu.be/T7V3WvU30Jk[/video]

Thanks everyone for the assistance!