Infiland / AsteroidsFeedback

This repo is for giving feedback and reporting bugs for Asteroids ++ , a free to play game made by the passionate game-dev Infiland
0 stars 0 forks source link

Can't buy an item even though you have enough money (minor bug) #17

Closed zone-a-1 closed 3 months ago

zone-a-1 commented 3 months ago

Version: Release 1.1.0

Problem: Sometimes you can't buy an item if [item cost = player money]. For example I bought some items and had $88 left, and I couldn't buy any items that cost $88, only items that were below that (I could buy an item that costs $50 without any problem).

Possible reason and fix: In the game you can pick up some coins that are valued below $1, for example yellow asteroids drop $0.3 coins. That means there are probably two different variables that store the player money. One that's the real money count, and one that's displayed to the player without the fractional part (so e.g. instead of 52.3, it displays 52). The problem most likely is when the fractional value is above 0.5, because then the number is rounded up, so most likely in my example I had $87.6 or $87.9, and the displayed value was rounded to $88, so even though it was showing that I had enough money, in reality I didn't. A fix to this problem would be to instead of rounding the displayed value up, use the floor mathematical function which always rounds the value down no matter the fractional value

Infiland commented 3 months ago

It is an issue since the shop formats prices and "hides" decimal numbers, buying items isn't a problem since the game always floors the money count, but the requirement isn't floored. This will be fixed in 1.1.0a

Infiland commented 3 months ago

Fixed in 1.1.1