Stoping Text overlapping
Blitz3D Forums/Blitz3D Beginners Area/Stoping Text overlapping
| ||
Ok Im writing a Text adventure, the players health etc is displayed across the top of screen and all the text input is underneath, but when the text begins to scroll up (after each print cmd etc) the text overlaps the text I Have at the top of the screen. please, How do I tell it to delete the Text when it reaches a certain hieght on the screen? (I hope Someone understands what im trying to say) Cheers (What I Mean is when the text reaches a certain place on the screen how do i delete just that line of text and not all of it.) Dan |
| ||
Use 'Text' instead, with a little routine to control HOW MANY LINES and CURRENT LINE POSITION. Also, it sounds like you're writing directly to the frontbuffer and not writing to the back and FLIPping. I have an example for you, but can't post it until I get home later |
| ||
If you use Print command, you may better use Text command instead, and appropriately set the x,y coordinates where to start to draw the text. Anyway, if the use of the print command is for you essential, you may try to clear an area around the top screen, before to show the text at the top (health etc.) Suppose you have this in your code - I could only guess, since you haven't posted any bit of code :-/ . . text topx,topy,"Health = " + health_value print your_text . . In this way, each time you print, the printed text scrolls up, and will overlap the text at the top, as you stated. To solve this problem, you can try this: ;first print your message text with print command: print your_text ;now reserve a graphics box where to route all the graphics commands to Viewport topx,topy,graphicswidth(),300 ;clear the box; this will get rid of the previously printed text that would overlap the next top text cls ;draw your text text topx,topy,"Health = " + health_value ;reset the viewport to the max viewport 0,0,graphicswidth(),graphicsheight() Bare in mind to use constant values instead of graphicswidth() and graphicsheight(), because they are functions that would be executed at each loop, while constant (or variable) values are already precalculated, saving cpu time. Hope it helps, Sergio. |
| ||
Cheers For The Help Guys, When i get back home i will try it out. Im sorry That I cant Print up the code, but I can only get internet access through a restricted pc (not my own) which doesent allow disks etc to be placed in them. And half the time I cant Remeber the exact code Im still a Newbie :) Cheers Dan |
| ||
Actually I wouldn't use the text command if I were you. I just finally got rid of all uses of it in my Blitz2D game. It's notorious for having a problem with being extremely slow with some video drivers (is this still the case or am I mistaken? I don't know if it works better with BlitzPlus, my bad if this doesn't apply anymore). I would draw the text from a loaded animimage containing all the letters,numbers, and any symbols you need. Good luck on the text adventure. I almost started work on one myself. |
| ||
It's notorious for having a problem with being extremely slow with some video drivers (is this still the case or am I mistaken? I believe the main issue with 2D over 3D driver issues has now been fixed by the relevant card manufacturers, although it's not recommended practice, and can have a speed impact. Ideally, bitmapped fonts are I think recommended by most users, although for a text-adventure game, I don't think you will find any problems. |
| ||
I would go with what Malice and Jaw said personaly,even if its just a text based game as for just the practice and learning skills could go a long way. Bottom line,there is a lot more things you could do with bitmaps then with just using text alone. |