forums

TNT Basic Forums > Programming Q&A
Draw Text Problem
< Last Thread     Next Thread >
Author
Thread        Post A Reply

09-22-2002 03:56

Posted by:
jamie

Find more posts by jamie

I am using Draw Text for my status bar. To keep track of my level number, number of lives, score and jet pack power.

When any of the number update on screen they just continually overwrite each other so there ends up being a white glob of characters where the numbers should be. Do I need to do something to erase the old value before writing the new one? Or am I missing something else?

Here is the code I'm using:

Procedure drawtext()

text size 15

draw text 25,570,"level:"+as string(currentlevel+1,0)
draw text 175,570,"lives:"+as string(lives,0)
draw text 325,570,"score:"+as string(score,0)
draw text 475,570,"power:"+as string(packpower,0)

end proc


Thanks

09-22-2002 23:39

Posted by:
Mathew

Find more posts by Mathew

Draw text cannot erase the old value. As there is no ID, TNT would not know wich one to erase. You need to overwrite the old text before making a new one. If your bar is just a one-color rectangle, you might want to use fill rect or paint canvas. If you have a specific picture for your bar, use paste picture.

09-23-2002 01:40

Posted by:
jamie

Find more posts by jamie

Thanks Mathew, right now my bar is just solid black so I'll write of it each time.

Thanks!

07-16-2003 13:24

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Hi,
No point in making a new post as jamie's problem is similar to mine...I've got a very simple code, below, that has been put into a separate file to make sure it is not ben affected by other sprites and variables so it is easier to de-bug. But it is not working as expected at all, for some reason the text doesn't print. At first I thought the rectangle might be drawing over it and obscuring it, but this also happens when the 'fill rect' command is reemed and when the code is used outside of the proc without the proc ever been declared(?) I've got text to print no problem in other parts of my project using the same-or very similar syntax.

graphics mode 640,480
frame rect 0,0 to 640,480

Global int startTime=timer
Global int Score=0
ProgressBar()

Procedure ProgressBar()
int Score=0

set pen colour white
fill rect 0,420 to 640,480
text size 15
set pen colour black
draw text 20,600,"Time remaining:" +As string (timer-startTime)
draw text 40,600, "Player Score:"+As string (Score)
draw frame
End proc

wait mouse click
end

what's going on?
mark_667

07-16-2003 16:29

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Umm...

I think you're drawing text off the screen :).

draw text 20,600,"Time remaining:" +As string (timer-startTime)
draw text 40,600, "Player Score:"+As string (Score)

if you set the resolution to 640x480, (20,600) is way below the screen.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.