Its actually an often requested feature and I'm sure you could find a tutorial on this somewhere, but I'll tell you my own approach. If you're familiar with the CallBack controls of the text blitter object (I mean *very* familiar) it can do this exact effect, with a lot greater options than anything else.
You should have a large text blitter that overlaps the entire window and does not follow the frame. Somehow, you should instantiate multiple lines of text inside the blitter that would correspond to each object. This could prove very tricky to pull off. One possible way of doing this, if you don't care about the # of active objects, is to just create a new active object as a dummy unit offscreen to record the values of the line of text to be displayed.
So for example:
Code:
+On enemy being hit by sword"
=Create "dummytext" @ (-100,-100)
=Set value text_posx of "dummytext" to X("enemy")
=Set value text_posy of "dummytext" to Y("enemy")
=Set string damage of "dummytext" to str$(damage done by player)
=Set value duration of "dummytext" to 50
=Set value string_length of "dummytext" to len$(damage("dummytext")
Then, you should run very specific controls of the callback on the text blitter. The easiest way to do this is to load up the text of the text blitter with something like 100x repeating "A" characters ("AAAAAAAAAA....."). Doesn't actually matter which character. Remember to enable "On Character Callback".
Create a callback event, which should display the text for the damage. This is where it gets tricky. You need the game to display as many characters in a row for each damage as the length of the string, but the callback goes on a 'per character' basis. Since the order you draw the characters wouldn't matter, an interesting way to do this would be to keep a variable inside each "dummytext" object that keeps track of how many characters are left. On the character callback, you can position the X & Y of the string, as well as the transparency.
An implementation would look like this:
Code:
+Callback: On Begin
=Set flag 1 of "dummytext" to OFF
=Set flag 2 of "dummytext" to OFF
=Set value counter("dummytext") to 0 (zero)
+Callback: On character
=Callback-> Set destination X to -100
(this causes extra numbers to not be displayed)
Code:
+Callback: On character
+Flag 1 of "SomeOtherObjectInTheGame" is OFF
+Flag 2 of "dummytext" is OFF
+Pick a "dummytext" at random
=Set Flag 1 of "dummytext" to ON
=Set Flag 1 of "SomeOtherObjectInTheGame" to ON
(this picks a random dummy text that hasn't yet been drawn to the screen to be the one rendered- this way the game will only being drawing a single dummy at a time. The flags look like this:
Flag 1 of dummytext: "is this object drawing currently?"
Flag 2 of dummytext: "has this object already drawn?"
Flag 1 of someotherobject: "is a dummytext already drawing?")
Code:
+Callback: On Character
+Flag 1 of DummyText is ON
=Callback: Set Destination X to (text_posx(dummytext) + 8 * counter(dummytext))
=Callback: Set Destination Y to (text_posy(dummytext))
=Callback: Set Source X/Y to (stuff, see below)
=Callback: Set Transparency to (whatever, maybe duration * 2)
=Add 1 to value Counter("dummytext")
you need to somehow format the image on your text blitter so that you can easily retrieve the positions of the number images. An easy way to do this would be to put 0/1/2/3/4/5/6/7/8/9 all in one big horizontal strip. Then, you could retrieve the source positions like this:
Source X = val(damage(dummytext)) * 16
Source Y = 0
Code:
+Callback: On Character
+Flag 1 of "Dummytext" is ON
+Counter("dummytext") == string_length("dummytext")
=Set Flag 1 of Dummytext to OFF
=Set Flag 1 of SomeOtherObjectInTheGame to OFF
(this inactivates the dummy text once the full string has been read).
I really ought to have just made an example for you, which I probably could have done even faster than writing this out. But that would have been much to vulgar a display of power, my dear father karras.