0 Favourites

How do I increase costs by percentages

  • I have a button set up that I want to increase it's cost each time it is clicked by maybe 5%. I've searched but can't find anything on it anywhere. Right now i have it set at a fixed cost and have 10 sub events to allow it to be clicked 10 times but I also want it to be clicked as many times as they have money to buy it. I'm not looking for someone to do everything for me, only point me in the direction needed. thanks

  • 5% = multiply by .05

    have a variable.

    on click, up the variable by the percentage.

    (variable = variable * 1.05)

    use that variable to calculate the cost.

  • What you wrote makes sense to me but trying to implement it isn't going well. I wrote System|variable name = 25=25*1.05. is that what i needed to do if i was trying to make $25 increase by 5%?

  • I don't see that anywhere in your capx, but if you set the variable to 25*1.05, then that variable is just set at 26.25.

    if you want to add 5% each time a button is clicked, then you would

    on clicked | set variable "whatever" = whatever * 1.05.

    this will add 5 per cent to the current number in the variable "whatever".

    I would suggest naming your different buttons to something relevant

    and not naming your variable a number (doesn't make much sense, if the number is going to change)

  • ok I don't know how I got it working but it is. Now I need help getting the Numbers to round up to next highest so i don't have 27.358823 as my total money.Also is there a way to get the price to show up inside the button and update there? I haven't looked for these answers yet but you seem to know what you are doing and would save me time. thanks for the help so far too

  • I just pretend to know what I'm doing. I'd suggest looking for the answers. you'll learn a lot more that way.

    ok I don't know how I got it working but it is.

    This is not a good thing. heh.

    round(blah blah blah)

    will round things

    floor(blah blah blah)

    will round them down

    ceil(blah blah blah)

    will round them up

    Read the fabulous manual!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • ok and since you posted that about round and the others i do recall reading about them now in the manual. It's just so much easier getting the answers like this because half the time I don't even know what it is I need to look up thanks again

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)