Calculating percentages
Blitz3D Forums/Blitz3D Beginners Area/Calculating percentages
| ||
In my current game I am trying to create a summary page that tells the user the number of shots fired, number of enemies hit and then an accuracy percentage based on those values. Unfortunately, the method I use to do this doesn't seem to work in Blitz: accuracy_percent# = enemies_hit / shots_fired On any calculator an equation like 4 divided by 8 would result in .5 , or 50 percent. But Blitz always returns a zero when I attempt to do any calculations like this. Any workarounds? Thanks. |
| ||
accuracy_percent#=float(enemies_hit)/float(shots_fired) should work |
| ||
Yup, works great! Thanks! |