Weekly Qbasic and Qb64 Lesson Topics
July 22, 2018, 05:21:02 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

PRINTS TEXT Across Screen


Pages: [1]
  Print  
Author Topic: PRINTS TEXT Across Screen  (Read 1051 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« on: April 15, 2011, 10:34:01 pm »

I did it ! but I am sure there is a better way useing the _autodisplay in your tutorial,....
Code:
DO
    CLS
    _DELAY 1
    LOCATE 5, 6
    PRINT "T"
    _DELAY 1.2
    LOCATE 5, 7
    PRINT "H"
    _DELAY 1.2
    LOCATE 5, 8
    PRINT "I"
    _DELAY 1.2
    LOCATE 5, 9
    PRINT "S"
    _DELAY 1.2
    LOCATE 5, 11
    PRINT "I"
    _DELAY 1.2
    LOCATE 5, 12
    PRINT "S"
    _DELAY 1.2
    LOCATE 5, 14
    PRINT "H"
    _DELAY 1.2
    LOCATE 5, 15
    PRINT "E"
    _DELAY 1.2
    LOCATE 5, 16
    PRINT "L"
    _DELAY 1.2
    LOCATE 5, 17
    PRINT "L"
    _DELAY 1.2
    LOCATE 5, 18
    PRINT "O"
    _DELAY 1.2
    LOCATE 5, 20
    PRINT "W"
    _DELAY 1.2
    LOCATE 5, 21
    PRINT "O"
    _DELAY 1.2
    LOCATE 5, 22
    PRINT "R"
    _DELAY 1.2
    LOCATE 5, 23
    PRINT "L"
    _DELAY 1.2
    LOCATE 5, 24
    PRINT "D"
    _DELAY 1.2
    LOCATE 5, 25
    PRINT "!!!"
    _DELAY .5
LOOP

 
I got to thinking, and this is one way I could...
form Garry
Report Spam   Logged

Social Buttons

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #1 on: April 15, 2011, 11:47:11 pm »

So I started thinking some more and came up with this,
Code:
DEFLNG A-Z
SCREEN _NEWIMAGE(640, 480, 32)
CLS
_DELAY 1
LOCATE 5, 6
PRINT "T"
_DELAY 1.2
LOCATE 5, 7
PRINT "H"
_DELAY 1.2
LOCATE 5, 8
PRINT "I"
_DELAY 1.2
LOCATE 5, 9
PRINT "S"
_DELAY 1.2
LOCATE 5, 11
PRINT "I"
_DELAY 1.2
LOCATE 5, 12
PRINT "S"
_DELAY 1.2
LOCATE 5, 14
PRINT "H"
_DELAY 1.2
LOCATE 5, 15
PRINT "E"
_DELAY 1.2
LOCATE 5, 16
PRINT "L"
_DELAY 1.2
LOCATE 5, 17
PRINT "L"
_DELAY 1.2
LOCATE 5, 18
PRINT "O"
_DELAY 1.2
LOCATE 5, 20
PRINT "W"
_DELAY 1.2
LOCATE 5, 21
PRINT "O"
_DELAY 1.2
LOCATE 5, 22
PRINT "R"
_DELAY 1.2
LOCATE 5, 23
PRINT "L"
_DELAY 1.2
LOCATE 5, 24
PRINT "D"
_DELAY 1.2
LOCATE 5, 25
PRINT "!!!"
_DELAY .5
WorkPage& = _LOADIMAGE("NEWGHOST_blu1.png")
_DEST 0

DO
    FOR x = 0 TO 261 STEP 67
        _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)
        _DELAY .08
    NEXT
    LOCATE 15, 20
    PRINT " I am the ghost comeing to save the world"
    LOCATE 25, 4
    PRINT " use ctrl-pause to exit"

LOOP
'I couldn't remember ,how to say look until the escape key is hit, I have it some
'where, tommorow I'll fix that.
 
You would need this image, or change the name and use any image.
 In my earlier question, about loading text from a file, this is sort of what I had in mind, but to be able to have the text or letters in a file, that could load,...I guess that may be what _include and useing librarys are about ?....Any way I enjoyed putting this together,...on my own, but eagerly look forward to seeing a better way.
from Garry
« Last Edit: April 15, 2011, 11:51:56 pm by GarrisonRicketson » Report Spam   Logged

guest
Guest
« Reply #2 on: April 16, 2011, 02:31:43 am »


    Here's an example of customising your code garry. It does not allow for continuing ghost movement because of the method i chose to implement it.
Code:
DEFLNG A-Z
SCREEN _NEWIMAGE(640, 480, 32)
CLS
Textprn$ = "Hello World !!!": RRow% = 6: CColumn% = 6: z% = 0: Pause! = .5
GOSUB Showtext
_DELAY .5
WorkPage& = _LOADIMAGE("NEWGHOST_blu1.png")
_DEST 0

Textprn$ = " I am the ghost comeing to save the world": RRow% = 15: CColumn% = 20: z% = 0: Pause! = .025

DO
  FOR x = 0 TO 261 STEP 67
    _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)
    _DELAY .08
  NEXT
  LOCATE 15, 20
  PRINT STRING$(LEN(Textprn$), 32)
  GOSUB Showtext
  LOCATE 25, 4
  PRINT " press + hold escape to exit"

LOOP UNTIL _KEYDOWN(27)
SYSTEM
END

'I couldn't remember ,how to say look until the escape key is hit, I have it some
'where, tommorow I'll fix that.

Showtext:
z% = 0
Length% = LEN(Textprn$)
FOR a = 1 TO Length%
  LOCATE RRow%, CColumn% + z%
  PRINT MID$(Textprn$, a, 1)
  z% = z% + 1
  _DELAY Pause!
NEXT a
RETURN

Note how i reused the gosub twice with differing text and delay time.

« Last Edit: September 11, 2011, 11:00:36 pm by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #3 on: April 16, 2011, 07:42:38 am »

Ok, I see what you did useing the sub,..and how textprn$ dose evrything in one line,...thats part of what I was looking for,...
hopefully this weekend I get a chance to study this more.
from Garry
Edit:
Quote
  Here's an example of customising your code garry. It does not allow for continuing ghost movement because of the method i chose to implement it
Yes just another example, of how he "customized" what I wrote, and gives me code that it totally useless, for what I was trying to do,..If it dose not or can not allow, for the ghost movement, then why did he post it ?
.------------------ Well it might be useful to someone, so I will leave it in here.
 This what he would do to anything I wrote. I am glad he is gone now.
« Last Edit: September 11, 2011, 11:50:27 pm by GarrisonRicketson » Report Spam   Logged

Dustie Bear
Full Member
***
Posts: 115


« Reply #4 on: April 20, 2011, 08:07:00 pm »

 Just to add my three cents worth,  lol

Heres another way to print across the screen
Its very similar ,  but
a little differant. I didnt use a sub but would
be easy to do.


Dustie

Code:
SCREEN 12
COLOR , 7
CLS
a$ = "Another way to write across the screen!"


' Center the text

' Since this text will be 8 pixels per chr we divide screen width
' by 16 to find text center.
xx = _WIDTH / 16

'Then subtract center value from length a$ / 2
xx = INT(xx - LEN(a$) / 2)

FOR x = xx TO LEN(a$) + xx
   c = INT(RND * 6) + 1
   COLOR c ' --- set color for each character
   b = b + 1 ' --- Select next character to be printed
   LOCATE 15, x
   PRINT MID$(a$, b, 1); ' --- Do the print centered

   _DELAY .2 ' Slow it down a bit
NEXT x

COLOR 0: LOCATE 18, 5
PRINT "press a key to End";
SLEEP
SYSTEM
« Last Edit: September 12, 2011, 08:51:55 am by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #5 on: April 20, 2011, 08:25:54 pm »

Thanks Dusty, I had been thinking about that, to add colored text,..
from Garry
« Last Edit: April 20, 2011, 09:29:10 pm by GarrisonRicketson » Report Spam   Logged

Dustie Bear
Full Member
***
Posts: 115


« Reply #6 on: April 20, 2011, 08:57:59 pm »


Your welcome Gary,

I just did a mode on that one to center the text on the screen
instead of  putting up another version.


Dustie
Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #7 on: April 20, 2011, 09:32:27 pm »

Ok I see , it,...and where you remarked, do the print centered,
from Garry
Report Spam   Logged

Dustie Bear
Full Member
***
Posts: 115


« Reply #8 on: April 21, 2011, 11:23:40 pm »



I think an idea of doing that would be to put it in a
sub then pass the vars to it kinda like  circle or line do. then it could be called anytime and as many times as a program demanded. IT would apear to be multitasking.

your program is pretty much set up for it though with the sub routine. Mine has a bit to much code in it to be realy fast for
multitasking I think. It could be rewritten a with faster commands I
suppose. Might need to leave out the color stuff.

Dustie

Report Spam   Logged
Dustie Bear
Full Member
***
Posts: 115


« Reply #9 on: April 22, 2011, 04:59:53 pm »

Ok this is the outline I am thinking of at the moment.  Never mind
the vars I used in the Call, I know they can't be used for real.  Wink

Wouldn't even need color unless we want to.

'  --- call the Sub
PrintAcross a$, Row, Line, Color    ' --  these vars are  illegal kinda like underscores. LOL


'  -- The sub
Sub PrintAcross (T$, R as integer, L as integer, C as Long

If color is to be used then it needs to recognize if _RGB is being used
or just color 1 to 15. I guess long var would take care of most of it.

' make the sub as simple or complicated as we want.

End Sub

« Last Edit: April 22, 2011, 05:06:53 pm by Dustie Bear » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #10 on: September 11, 2011, 11:13:35 pm »

So I started thinking some more and came up with this,
Code:
DEFLNG A-Z
SCREEN _NEWIMAGE(640, 480, 32)
CLS
_DELAY 1
LOCATE 5, 6
PRINT "T"
_DELAY 1.2
LOCATE 5, 7
PRINT "H"
_DELAY 1.2
LOCATE 5, 8
PRINT "I"
_DELAY 1.2
LOCATE 5, 9
PRINT "S"
_DELAY 1.2
LOCATE 5, 11
PRINT "I"
_DELAY 1.2
LOCATE 5, 12
PRINT "S"
_DELAY 1.2
LOCATE 5, 14
PRINT "H"
_DELAY 1.2
LOCATE 5, 15
PRINT "E"
_DELAY 1.2
LOCATE 5, 16
PRINT "L"
_DELAY 1.2
LOCATE 5, 17
PRINT "L"
_DELAY 1.2
LOCATE 5, 18
PRINT "O"
_DELAY 1.2
LOCATE 5, 20
PRINT "W"
_DELAY 1.2
LOCATE 5, 21
PRINT "O"
_DELAY 1.2
LOCATE 5, 22
PRINT "R"
_DELAY 1.2
LOCATE 5, 23
PRINT "L"
_DELAY 1.2
LOCATE 5, 24
PRINT "D"
_DELAY 1.2
LOCATE 5, 25
PRINT "!!!"
_DELAY .5
WorkPage& = _LOADIMAGE("NEWGHOST_blu1.png")
_DEST 0

DO
    FOR x = 0 TO 261 STEP 67
        _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)
        _DELAY .08
    NEXT
    LOCATE 15, 20
    PRINT " I am the ghost comeing to save the world"
    LOCATE 25, 4
    PRINT " use ctrl-pause to exit"

LOOP
'I couldn't remember ,how to say look until the escape key is hit, I have it some
'where, tommorow I'll fix that.
 
You would need this image, or change the name and use any image.
 In my earlier question, about loading text from a file, this is sort of what I had in mind, but to be able to have the text or letters in a file, that could load,...I guess that may be what _include and useing librarys are about ?....Any way I enjoyed putting this together,...on my own, but eagerly look forward to seeing a better way.
from Garry
The image is avaiable here:http://weeklyqbasicandqb64lesson.smfforfree.com/index.php?action=dlattach;topic=136.0;attach=23
from Garry
« Last Edit: September 11, 2011, 11:15:10 pm by GarrisonRicketson » Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #11 on: September 12, 2011, 08:58:31 am »

Galleon, on QB64, http://www.qb64.net  posted this,
To see the original post:  http://www.qb64.net/forum/index.php?topic=4469.msg46219#msg46219
--------------------------------------
It truely is better, and the Ghost still has it's movement, later this week I will try to work on explaining , more ...The sprite sheet is the same.
Code:
DEFLNG A-Z
SCREEN _NEWIMAGE(640, 480, 32)

m$ = "THIS IS HELLO WORLD !"
fps = 2
FOR i = 1 TO LEN(m$)
    c$ = MID$(m$, i, 1)
    IF c$ <> " " THEN _LIMIT fps
    IF c$ = "!" THEN c$ = "!!!"
    PRINT c$;
    IF LEN(INKEY$) THEN fps = 10
NEXT
_DELAY 1.5


WorkPage& = _LOADIMAGE("NEWGHOST_blu1.png")
_DEST 0

_SETALPHA 0, _RGB(0, 0, 0) TO _RGB(50, 50, 50), WorkPage&

DO
    CLS , _RGB(0, 0, 0) '///Note , I (garry) did change this, it had a green back ground, as Galleon had it,anyone can experiment with useing different colors.

    _PUTIMAGE (100, 100)-(220, 190), WorkPage&, 0, (x, 0)-(x + 67, 67)
    x = x + 67: IF x > 261 THEN x = 0

    LOCATE 15, 20
    PRINT " I am the ghost coming to save the world !!! "

    IF INKEY$ = CHR$(27) THEN EXIT DO
    LOCATE 25, 4
    PRINT " Use the ESC key to exit "


    _LIMIT 10
    _DISPLAY
LOOP
 
Thanks again Galleon, for shareing this.
from Garry
« Last Edit: September 12, 2011, 09:04:08 am by GarrisonRicketson » Report Spam   Logged


Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Buy traffic for your forum/website
traffic-masters
Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy