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 / using CREATE ANIMATED SPRITE to make a custom font?

Author
Message
ForgottenMyth
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location: 420
Posted: 17th Sep 2010 20:50
hello, i recently started using DBPro and i am loving it. I'm currently trying to create an effect with sprites similar to this:


By using CREATE ANIMATED SPRITE im attempting to split an image into 256 frames (a complete ASCII font set) take a string and split the letters into their ASCII values so that i can create sprites with the frames set to the ASCII values.

After about a day of looking in here i decided my goal was slightly unique and now im looking for help
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Sep 2010 01:32
You don't really need all 256 characters to make a text font. You only need ASCII numbers 32 to 126 to get every letter the user is likely to type on the keyboard (symbols, higher case letters and lower case letters). Once their on a single image you load it using that same command you mentioned and make a small routine using a sprite and the SET CURRENT FRAME command to switch to the desired letter.

ForgottenMyth
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location: 420
Posted: 19th Sep 2010 07:16 Edited at: 19th Sep 2010 22:12
yeah, got that working after awhile, thats when i discovered the part about not all letters are the same size.

then i found a tutorial made by Van B (his bruce lee game) solving all my font problems except that now i cant get the text to display on screen. Im having trouble figuring out what to add that will display these letters, ive gotten 1 animated sprite to display and music to play. but no sweet font

spent another whole day looking through his stuff to see how he did it and i cant see anything wrong with mine

-EDIT: got it solved, but now its not using the image alpha (im using .tga files for the image)
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Sep 2010 00:43
You have to put SET BITMAP FORMAT 21 at the top of the code to set all future bitmaps created (including bitmap 0) and any images grabbed to keep the images alpha transparency.

ForgottenMyth
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location: 420
Posted: 20th Sep 2010 02:53
didnt work, there's probably something else wrong in my code but i have yet to find it
ForgottenMyth
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location: 420
Posted: 21st Sep 2010 08:05
hehe my problem was:

<- didnt put 1 for transparency

Login to post a reply

Server time is: 2026-07-24 23:12:34
Your offset time is: 2026-07-24 23:12:34