Help with Score Tags
Blitz3D Forums/Blitz3D Programming/Help with Score Tags
| ||
The plan is to get a score to appear in place of a destroyed object - by just writing it on a textured sprite or quad and fade it over a period of 2-3 secs. I need to write to the texture, in game, as the score could be between + or - ( 100 to 10000)points, so I can't just make an anim texture and load it with alpha flag. It's all quite easy to do ( in theory!!) but the problem I'm having is that every time I write a score to a texture I need to then call some form of alphamask routine so that it displays right and I can fade it properly. I want to just be able to write the score to the texture and viola?! Is there any quick way around this. Cheers Stevie |
| ||
A method I would try would be to have an image containing digits 0-9 and then copyrect the required digits onto the texture. Not sure how fast this would be as it would require 5 copyrects to create the 10000 points texture. However, the copyrects will only need to be pretty small so I would be surprised if this method was too slow. |
| ||
I don't think there is a way to access the alpha channel of an image in blitz, but you could have the digits 0-9 precreated with alpha, and use that as a texture, then adjust the u/v coords to create the right sequence of digits. (I think). |
| ||
Oooh, you mean have a set of 5 quads, each textured with the 0-9 texture and then adjust the UVs (only need to alter the U, I think) to show the correct digit? Thats a neat idea! ;) |
| ||
Yes, that's what I mean, but he would need 6 quads since it can vary from +/- 10000 :) |
| ||
I thought you could reassign the texturebuffer... I saw a code snip that was freeware out there like this:tex3=CreateTexture(128,128) SetBuffer TextureBuffer(tex3) Color 127,127,127 Text 0,0,"DEAD!" SetBuffer BackBuffer()In the particle engine I use this creates a sprite of words... I am not sure exactly how but there is no other code to manage it and the image is only the words... Just showing what I use... Probably no help! |
| ||
Good ideas - thanks. I'm keen to just have one quad though - a bit too much faffing around for such a simple think. Big& - I would probably just drawblock / image instead of copyrect the numbers - should be fastest? I know I can use additive blend but then I can't fade it. I think this is probably what the particle engine is doing - unless you care to share? Unless there's a way to fade an additively blended texture without changing the colour every frame? |
| ||
Unless there's a way to fade an additively blended texture without changing the colour every frame? I myself would be interested in that too!!! |
| ||
Big&(sic) - I would probably just drawblock / image instead of copyrect the numbers - should be fastest? Possibly - I'm not too familiar with alot of 2D commands. :) I know I can use additive blend but then I can't fade it. I think this is probably what the particle engine is doing - unless you care to share? Unless there's a way to fade an additively blended texture without changing the colour every frame? I think just ramping down the EntityAlpha to 0 will work. [edit] forget that - you probably need something that works in a single surface system. |