How do I make a button 10 , 25 and 100 X for an incremental game?

0 favourites
  • 11 posts
From the Asset Store
This sound pack comes with 100 high quality, ready-to-use sound effects for all kinds of games.
  • Ok let me explain i a incremental game that when i press a button it does the folowing.

    set current price to -floor(base price * (level ^ 1.o7))

    -Add 1 to level

    Now i want to make buttons to do it 10x, 25x and 100x if i do just *100 for example i get the wrong value ofcourse . I just can't wrap my head around the good thing to do here.

    Also i need the to check if you have enough money to buy it so if

    -current money - cost price => 0 you can buy.

    The thing i tried is make a global variable called multiplier.

    Base value 1 when i press the button 10x set it to 10 and so on.

    Then use the multiplier in the code is just tried a lot of thing with the wrong outcome can some please help me in the right direction.

  • You are already in the right direction, not sure how anyone could assist more. You have a problem multiplying current price by 10 ? I mean it sounds quite simple and shouldn't cause any problems if the normal formula is working.

  • If I just multi by 10 it doesn’t do all the 1.07 ^level every level. So it’s cheaper to buy 10x then 10 times 1x.

    I am missing some logic in math.

  • You'll have to share a screenshot of the events if you put something in the wrong place

  • It's not really clear what you're trying to do here, but I see you increase the level by 1*multiplier which looks wrong and should be +1? Other than that I don't see any problems. If there is a problem you'll have to be specific about the cases and expected outcome because it looks fine to me except that increase in level since you said it should only increase by 1.

  • Ok i'll try to explain.

    When i buy 10 times X1 is spent 70 total. Is i switch to x10 is says the cost to lvl 11 is 50.

    An other example is i buy 25 times 1X the total cost is 327 is i switch to 25 times it is 125 (i cant get the logic to fix it).

    So the outcome of 70 and 327 are good.

    I want buttons to make it easy for the player to buy more in one go but with the same increment.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll let someone else look at it, maybe post it again with better information. You buy 10x then it says level 1, if you buy 1x 10 times then the level increases and the cost changes. No idea what the design is here.

  • here is a link to download the example

  • I tried to do this. Now i can add 10,25 or 100 levels and get te cost of all levels.

    * On function 'Function1' → Number

    * Parameter 'StartLevel' (Number)

    * Parameter 'EndLevel' (Number)

    | Local number Total‎ = 0

    ----+ System: For "" from StartLevel to EndLevel

    -----> System: Add floor(5×1.07^LoopIndex) to Total

    ----+ (no conditions)

    -----> Functions: Set return value Total

    + Touch: On touched Buy

    ----+ System: Money-Functions.Function1(Level+1,Level+Multiplier) => 0

    -----> System: Subtract Functions.Function1(Level+1,Level+Multiplier) from Money

    -----> System: Add Multiplier to Level

    -----> TextPixel: Set text to Money

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