Discuss Scratch

WLqcking
Scratcher
5 posts

Can't calculate the cost before something's bought because of buy mulitpliers

I'm trying to add buy multipliers into my game but every time the you buy something the cost go up x times itself. this would be much of a problem if I didn't add something that keeps track of the cost before you buy. I have no idea how to calculate that help please game here
invalidaccess
Scratcher
58 posts

Can't calculate the cost before something's bought because of buy mulitpliers

what do you mean exactly give more info
WLqcking
Scratcher
5 posts

Can't calculate the cost before something's bought because of buy mulitpliers

Well, one upgrade cost $20, and multiples by 2 whenever it's bought. My code for showing the cost of the upgrade looks like this: If touching mouse pointer, set “for all variable: Cost Sprite” to “for this only variable: Cost of upgrade”, so if I wanna buy only 1(buy multiplier = 1) of these upgrades (the one I was talking about previously), the “Cost Sprite” (the sprite that shows how much the upgrade will cost) says 20. But what if instead I want buy 2 at the same time, the “Cost Sprite” will still say 20, but in reality, it should say 60 since it'll double every time it's bought(20 + 40). I'm tryna make it say 60 or 140(20 + 40 + 80) or 300(20 + 40 + 80 + 160) and so on and so fourth. Btw, my code for the buy multipliers is “repeat ‘buy multiplier’ times: if you have enough money, buy upgrade”
WLqcking
Scratcher
5 posts

Can't calculate the cost before something's bought because of buy mulitpliers

invalidaccess wrote:

what do you mean exactly give more info
Is this how you reply to people, this is my first time using the forums
WLqcking
Scratcher
5 posts

Can't calculate the cost before something's bought because of buy mulitpliers

invalidaccess wrote:

what do you mean exactly give more info
Better example: ever play idle games like ADventure Capitalist and notice how when you set the buy multiplier max, the number that shows you how much it'll cost is exact, even though the cost of the upgrade will most likely multiply by itself for each time it'll be bought? I'm trying to do that in my game.
WLqcking
Scratcher
5 posts

Can't calculate the cost before something's bought because of buy mulitpliers

Nevermind I figured it out.

Powered by DjangoBB