writting a simple text program

Blitz3D Forums/Blitz3D Beginners Area/writting a simple text program

seferey(Posted 2005) [#1]
Hi um I am curious about something

I'm trying out the text command but is there a way to.

1. The text shows up on the screen.

2. It clears screen.

and 3. shows the rest of the text after clear screen.


seferey(Posted 2005) [#2]
Text 50,90,"Anyway what do you think know"



Text 50,100,"About my Blitz3D program Skills "


Text 50,110,"Huh! This Text is nothing compared."


Text 50,120,"To the true power of Blitz3D."


Text 50,150,"To Exit Hit Esc key on your keyboard."

While Not KeyHit(1)

Wend


seferey(Posted 2005) [#3]
also is there a way to move the text slowly up or down
and one line of the sentence dissappears.

Like Credits from a movie


GfK(Posted 2005) [#4]
Don't quite know what you're on about, but, the EDIT button is your friend.


Matty(Posted 2005) [#5]
graphics 800,600,16,2
dim Mytext$(5)
Mytext$(0)="Anyway what do you think know"
Mytext$(1)="About my Blitz3D program Skills " 
Mytext$(2)="Huh! This Text is nothing compared." 
Mytext$(3)="To the true power of Blitz3D." 
Mytext$(4)="To Exit Hit Esc key on your keyboard." 
Mytext$(5)="...."
i=0
time=millisecs()+1000
repeat
if millisecs()>time and i<5 then 
time=millisecs()+1000
i=i+1
endif 
cls
text 50,100,mytext$(i)
flip
until i>=4 and keydown(1)>0
end


or if you want it scrolling:
graphics 800,600,16,2
dim Mytext$(5)
Mytext$(0)="Anyway what do you think know"
Mytext$(1)="About my Blitz3D program Skills " 
Mytext$(2)="Huh! This Text is nothing compared." 
Mytext$(3)="To the true power of Blitz3D." 
Mytext$(4)="To Exit Hit Esc key on your keyboard." 
Mytext$(5)="...."
y=600
repeat
cls
if millisecs()>time then y=y-1:time=millisecs()+50
for i=0 to 5
text 100,y+15*i,Mytext$(i)
next
flip
until keydown(1)>0
end




seferey(Posted 2005) [#6]
Thank you soo much Matty


seferey(Posted 2005) [#7]
for showing me how to make it scroll now um how
do you adjust the text to the left , right or middle of the screen

:)


BlackJumper(Posted 2005) [#8]
this line...
text 100,y+15*i,Mytext$(i)

is using an x-ordinate of 100 each time. Instead you could use Len$(MyText$(i)) to figure out how many characters are in the phrase and then adjust the x value accordingly.

Give it a try, ask for help if you can't get it.

P.S. This might not be the most efficient way of doing this - Text has two optional parameters that decide whether the output is centred...
Text x,y,string$,[center x],[center y]
usage... Text 400,0,"Hello There!",True,False



seferey(Posted 2005) [#9]
text 100,y+15*i,Mytext$(i) worked. But the other one didn't

expecting expression or something


seferey(Posted 2005) [#10]
Thanks Black Jumoer :)


WolRon(Posted 2005) [#11]
seferey, there is an Edit button at the top right of every one of your posts. You're welcome to use it...


BlackJumper(Posted 2005) [#12]
The Len$() command will actually return the number of characters in the string... An even better measure is the StringWidth() function that gives you the answer in pixels.

Here is a modified version of MAtty's code. Note that the line that is commented out is the more efficient version of the two lines above. You could comment out (A) and (B) and uncomment (C) with no discernable difference. Hopefully lines A + B give you some insight into what is happening though !!

Graphics 800,600,16,2
Dim Mytext$(5)
Mytext$(0)="Anyway what do you think know"
Mytext$(1)="About my Blitz3D program Skills " 
Mytext$(2)="Huh! This Text is nothing compared." 
Mytext$(3)="To the true power of Blitz3D." 
Mytext$(4)="To Exit Hit Esc key on your keyboard." 
Mytext$(5)="...."
y=600
Repeat
Cls
If MilliSecs()>time Then y=y-1:time=MilliSecs()+50
For i=0 To 5
Adjustment = 400 - StringWidth(Mytext$(i))/2    ; (A) this calculates the 'width' needed to centre text
Text Adjustment,y+15*i,Mytext$(i)               ; (B) this prints text to the calculated position

;Text 400,y+15*i,Mytext$(i), True, False        ; (C) this line is equivalent to the two lines above

Next
Flip
Until KeyDown(1)>0
End