Fix a "buy 10" button that charges a different price than it showed
Upgrades get pricier with every purchase, and buying many at once is where the shown price and the charged price split apart, or the button says you can afford something you cannot. This entry shows how to make the AI price a bundle so the number always matches.
Why this works
A price the player sees must be the price the game charges, so there should be exactly one place where prices are worked out, and every button, check and charge must ask it. Two ways of calculating the same thing will sooner or later disagree.
When not to use it
Adding up prices one by one gets slow for huge purchases, and then a shortcut formula is fine if you accept a small error and also show that error honestly. Better still, choose a price curve that has no rounding at all.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 32 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Fix a "buy 10" button that charges a different price than it showed" (read_entry bulk-buy-price-differs-from-shown) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP