scrolling text

Blitz3D Forums/Blitz3D Programming/scrolling text

Amanda Dearheart(Posted 2004) [#1]
Like many programmers out there, I'm trying to develop my own rpg. Does anyone know how I would create scrolling text, like the type found in DiabloII and Baldur's Gate games.


WolRon(Posted 2004) [#2]
Well, I don't know what kind of scrolling text those games have but would this bit of code be of any use?

http://www.blitzbasic.com/Community/posts.php?topic=37964


GrrBrr(Posted 2004) [#3]
scrolling from left to right?

if you use a pixelfont you can simply change the coordinates every frame.. (in 2d)

in 3d its more difficult.. create a sprite, draw your string
on its texture. move the sprite across the screen.


gpete(Posted 2004) [#4]
Using the 2d Text command --- Text x,y,"your string..." , the horizontal position "x" and vertical "y" has to be an integer. A simple loop would allow it to scroll from bottom to top. But I think you want to set it up in a text box. Viewport x,y,width,height -allows you to define a rectangle that plain text will be visible in. Rect can make a colored background and Color can set the text color.

In general, I suggest looking at the 2d text commands.


Amanda Dearheart(Posted 2004) [#5]
Thanks for your help, guys. I guess I should be more specific when I post my questions. When I said scrolling text, I meant from bottom to top instead of left to right.


slenkar(Posted 2004) [#6]
do you mean for a message log, or an NPC conversation?


puki(Posted 2004) [#7]
Check this large, little, git out:

http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=gillissie01022003212523&comments=no

The above is more for fancy effects - but it is customisable.

Doing a small scrolling text system can be done cheaply by creating a few rows of strings and then just copying the contents of each string to the one above it. The text doesn't physically scroll - it more moves up line by line - but some RPG games use that rather than true scrolling.


slenkar(Posted 2004) [#8]
Is is single surface?


Amanda Dearheart(Posted 2004) [#9]
Slenkar
do you mean for a message log, or an NPC conversation?

Yes, I intended it to mean NPC conversation, but it could be for a message log as well!

Is is single surface?

Huh! What do you mean? single surface?

Puki

Thanks for the info! Will be in touch with you !


slenkar(Posted 2004) [#10]
http://www.blitzbasic.com/codearcs/codearcs.php?code=481

this may help,


gpete(Posted 2004) [#11]


Amanda, here's a really simple, 2D, (and not very good!) example of "Text x,y" that I was talking about in my previous message... this same kind of "window" can be used with 3D programs. You can also specify differant Fonts or letter styles and sizes.


slenkar(Posted 2004) [#12]
Graphics 800,600,16,1
SetBuffer BackBuffer() 

Viewport 200,200,500,200 
Color 255,100,50
a=220

While Not KeyDown(1)

a=a-1

Color 220,0,0
Rect 5,10,500,200,1
Color 255,255,255
Viewport 0,0,200,200 
Text 0,a,"This is the Evil first line of Text"
Text 0,a+20,"My name is the dread Pirate Roberts!"
Text 0,a+40,"Yada, Yada, Yada....You are all doomed!"
Text 0,a+60,"Well, bring me a nice Shrub, not too expensive.."
Text 0,a+80,"It's only a flesh wound!"
Text 0,a+100,"The Grail is hidden in the tower of Castle Anthrax"
Text 0,a+120,"As you wish, Buttercup..."
Viewport 400,200,200,200
Text 400,a,"This is the Evil first line of Text"
Text 400,a+20,"My name is the dread Pirate Roberts!"
Text 400,a+40,"Yada, Yada, Yada....You are all doomed!"
Text 400,a+60,"Well, bring me a nice Shrub, not too expensive.."
Text 400,a+80,"It's only a flesh wound!"
Text 400,a+100,"The Grail is hidden in the tower of Castle Anthrax"
Text 400,a+120,"As you wish, Buttercup..."
Flip
 Delay 60

 Cls
Wend
End


I modified the code a little to experiment with viewports, do you know why the text looks so odd?


Amanda Dearheart(Posted 2004) [#13]
Thanx guys,
These exeamples are writtne for the 2D version of Blitz. Will they work in 3D. I haven't fully researched the ViewPort instruction. Exactly what does it do?