How do I Add a 'Buy Multiple' Button

Get help using Construct 2

Post » Mon Apr 10, 2017 7:45 am

Hi, Just wondering how to do the math for a 'Buy Multiple' button (x1, x10, x25 etc) but the price increases with each one you buy.
In this case it looks like this:

1st one Costs $10, 2nd Costs $21, 3rd Costs $44 etc.. With an increase of floor(cost*2.1).

The problem I'm having is that, for example, if I click buy x10, the cost will be $1000 instead of (I believe) $15018.

Hope this makes sense. Thanks.
B
16
S
1
Posts: 26
Reputation: 644

Post » Mon Apr 10, 2017 8:38 am

On click
Repeat x times -

subtract cost from cash
Add 1 item
Set cost to floor(cost*2. 1)
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Mon Apr 10, 2017 9:46 am

Thanks, that helps with the subtraction of money. Another problem I have with it is that the cost is displayed before buying it. Still trying to figure out how to have the math work out how much it is going to cost before actually buying it
B
16
S
1
Posts: 26
Reputation: 644

Post » Mon Apr 10, 2017 10:22 am

This is the closest I can get: https://www.dropbox.com/s/tetva39um81sj ... .capx?dl=1

Enter the amount in the textbox. The error starting at n = 5, where the rounding (floor) will cause the difference.
B
33
S
10
G
2
Posts: 46
Reputation: 3,063

Post » Mon Apr 10, 2017 3:45 pm

Ah. Well then you can use 10*2. 1^(n-1) for both displaying and subtracting money, and just add n items straight away.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: FlyingRam, jkmalau, marcinkowski and 10 guests