Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Help with making my scores and health dissplayed with pictures

Author
Message
Daniel wright 2311
User Banned
Posted: 21st Oct 2011 06:22
here is the example picture I would like to use as one of my pictures, i have 0-9,do i need to create a sprite with the numbers,and if so how do use the sprite to dissplay the image with my health and score?

my signature keeps being erased by a mod So this is my new signature.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 21st Oct 2011 10:18
Scores are done just like bitmap fonts. We grab image numbers based on the ASCII character chart. On that chart numbers 0 to 9 are actually numbers 48 to 57. Once the images are grabbed using those ASCII numbers we can convert the score to a string, then use a simple FOR/NEXT loop with the ASC() command and MID$() to find out what ASCII numbers each character in the string actually are. For example if you have a score of 48200 and you did an ASC() check for each number they would be numbers 52 56 50 48 48. So if you grabbed an image of 4 as image number 52 pasting image number 52 would always show 4. It sounds complicated but it isn't.



Here's the ASCII chart:


Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 21st Oct 2011 14:05 Edited at: 21st Oct 2011 14:06
Following on from the last point, the ASCII numbers can also be reduced down to sprite frames; or even sprite Ids, or image Ids for sprites.

Even as far as object texture IDs if you where working on 3d character labels; or 3d fonts, or shaders, thus you can use the ASCII codes to define any form of text display, providing you return a valid index reference.

Daniel wright 2311
User Banned
Posted: 21st Oct 2011 21:04 Edited at: 21st Oct 2011 21:04
Is there any way I can get an example on how I might structure my code to read a sprite to work with health,thanks.

my signature keeps being erased by a mod So this is my new signature.

Login to post a reply

Server time is: 2026-07-11 02:55:42
Your offset time is: 2026-07-11 02:55:42