score system and bitmap fonts

Blitz3D Forums/Blitz3D Beginners Area/score system and bitmap fonts

GameCoder(Posted 2004) [#1]
I have an anim image that has th numbers 0 to 9. I want to use this for my scoring system. If somebody scores say 120, how can i convert this score so that it can print the three individual numbers, and display the appropriate image.

Basically the 1 anim image goes from 1 to 9. If someone scores 120, I want it to print the relevent frame from the anim image. This would save me having a font image that is all seperate numbers, ie 1, 123, 344 etc.


GameCoder(Posted 2004) [#2]
Sorry for posting this. I managed to do it.


Grisu(Posted 2004) [#3]
btw: you can find a good & free bmp fontlib here:
http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=cyberseth05162003013142&comments=no


Jeppe Nielsen(Posted 2004) [#4]
You could convert your value variable to a string and parse this, or use this math version:
num=234587
nn=Floor(Log10(Abs(num+(num=0))))+1
For n=nn To 1 Step -1
	frame=((Abs(num) Mod 10^n)-(Abs(num) Mod 10^(n-1)))/(10^(n-1))
	Text x,y,frame
	x=x+20
Next



StOrM3(Posted 2004) [#5]
Also, the nSprite lib has built in BMP fonts that work very well for this, even a function to built the bmp from a string, and updating the string etc..