Brian's Man Cave Posted January 6, 2022 Share Posted January 6, 2022 I am seeing many games now that have scrolling text... I assume this is done the same way you scroll a screen?? Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted January 6, 2022 Share Posted January 6, 2022 (edited) Which games? I ask because there are different techniques you can use. For instance: Screen scrolling: If there is nothing else on the screen, you can just use the regular SCROLL mechanism to scroll the text from one side to the other. If there are other things on the screen, they will scroll as well, unless you counter it by shifting them in the opposite direction. Sprites: If your text fits nicely in the number of sprites available, you can just display it as such and move them in unison, like you would any other sprite. The neat thing of this technique is that the text can overlap background elements while moving. I use this for short messages, like "Get Ready!," etc. GRAM card shifting: This is he opposite of the first one, where you want to scroll the text but nothing else on the screen, you can pre-shift the characters in GRAM cards, and then just cycle through them at runtime. Essentially you are animating the text by simulating their movement across a range of cards. You will have to pre-compute he position of the characters on every step of the scroll animation. If you are talking about games that show text scrolling vertically on the screen, like movie credits, those are probably done using the first technique above. dZ. Edited January 6, 2022 by DZ-Jay Quote Link to comment Share on other sites More sharing options...
Zendocon Posted January 6, 2022 Share Posted January 6, 2022 1 hour ago, Brian's Man Cave said: I am seeing many games now that have scrolling text... I assume this is done the same way you scroll a screen?? Scrolling a screen affects the whole screen, whereas for text you want to move a row of background cards only. In FUBAR, I have a chyron that displays scrolling text to guide the user through the various menus. If you want the code, I can send it your way. Quote Link to comment Share on other sites More sharing options...
Brian's Man Cave Posted January 6, 2022 Author Share Posted January 6, 2022 41 minutes ago, DZ-Jay said: Which games? I ask because there are different techniques you can use. For instance: Screen scrolling: If there is nothing else on the screen, you can just use the regular SCROLL mechanism to scroll the text from one side to the other. If there are other things on the screen, they will scroll as well, unless you counter it by shifting them in the opposite direction. Sprites: If your text fits nicely in the number of sprites available, you can just display it as such and move them in unison, like you would any other sprite. The neat thing of this technique is that the text can overlap background elements while moving. I use this for short messages, like "Get Ready!," etc. GRAM card shifting: This is he opposite of the first one, where you want to scroll the text but nothing else on the screen, you can pre-shift the characters in GRAM cards, and then just cycle through them at runtime. Essentially you are animating the text by simulating their movement across a range of cards. You will have to pre-compute he position of the characters on every step of the scroll animation. If you are talking about games that show text scrolling vertically on the screen, like movie credits, those are probably done using the first technique above. dZ. For Sprites, how would you make a line of text into a sprite? Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted January 6, 2022 Share Posted January 6, 2022 1 hour ago, Brian's Man Cave said: For Sprites, how would you make a line of text into a sprite? Either by making each sprite one character, or making small fronts that can fit into multiple sprites aligned horizontally. dZ. Quote Link to comment Share on other sites More sharing options...
Brian's Man Cave Posted January 6, 2022 Author Share Posted January 6, 2022 So I guess C Madruga did this with the scroll feature: Quote Link to comment Share on other sites More sharing options...
+cmadruga Posted January 6, 2022 Share Posted January 6, 2022 Yes. 1 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 7, 2022 Share Posted January 7, 2022 (edited) This is my code for credits scrolling. Probably I've shared it before a ton of times: ' Public domain by Oscar Toledo G. @nanochess show_credits: PROCEDURE ' Credits FOR c = 220 TO 239 #backtab(c) = 0 NEXT c GOSUB clear_sprites WAIT BORDER 0,2 WAIT offset_x = 0 offset_y = 0 offset_d = 0 #offset_base = -20 DO IF offset_y = 0 THEN offset_d = 4:offset_y = 7 ELSE offset_y = offset_y - 1 END IF SCROLL offset_x,offset_y,offset_d WAIT offset_d = 0 IF offset_y = 7 THEN #offset_base = #offset_base + 20 PRINT AT 220 y = credits_color(#offset_base / 20) IF y AND $80 THEN y = y AND $7F END IF FOR x = 0 TO 9 #c = credits_text(#offset_base / 2 + x) #d = #c / 256 IF #d = 32 THEN #d = 256 PRINT #d * 8 + y #d = #c AND 255 IF #d = 32 THEN #d = 256 PRINT #d * 8 + y NEXT x END IF FOR c = 0 TO 7 WAIT d = cont IF #offset_base = 0 THEN d = 0 IF d THEN c = 0: GOTO sc_cancel NEXT c LOOP WHILE #offset_base < 35 * 20 ' 35 is the total rows of text FOR c = 0 TO 239 WAIT d = cont IF d THEN c = 0: GOTO sc_cancel NEXT c sc_cancel: SCROLL 0,0,0 BORDER 0,0 WAIT GOSUB clear_screen END clear_screen: PROCEDURE CLS MODE 0,0,0,0,0 FOR d = 0 TO 7 SPRITE d,0 NEXT d WAIT END credits_text: DATA PACKED " Castle of Love " DATA PACKED " " DATA PACKED " A game by: " DATA PACKED " Rick Sanchez " DATA PACKED " " DATA PACKED " Music: " DATA PACKED " Morty Smith " DATA PACKED " " DATA PACKED " Manual: " DATA PACKED " Jerry Smith " DATA PACKED " " DATA PACKED " Box design: " DATA PACKED " Beth Sanchez " DATA PACKED " " DATA PACKED " Overlays: " DATA PACKED " Summer Smith " DATA PACKED " " DATA PACKED " Boxes by: " DATA PACKED " Nanocheetos " DATA PACKED " " DATA PACKED " Special thanks: " DATA PACKED " Robocop " DATA PACKED " " DATA PACKED " " DATA PACKED " " DATA PACKED " " DATA PACKED " " DATA PACKED " " DATA PACKED " Strange " DATA PACKED " Games. " DATA PACKED " (c) 2022 " DATA PACKED " " DATA PACKED " " DATA PACKED " " DATA PACKED " " DATA PACKED " " ' One color for each row credits_color: DATA 6,6 DATA 5,3,5 DATA 5,3,5 DATA 5,3,5 DATA 5,3,5 DATA 5,3,5 DATA 5,3,5 DATA 5,3,5,5 DATA 5,5,5,5,6 DATA 6,7,5,5 DATA 5,5,5 Edited January 7, 2022 by nanochess 2 Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 8, 2022 Share Posted January 8, 2022 On 1/6/2022 at 4:26 PM, DZ-Jay said: GRAM card shifting So instead of going to sleep, I decided to try this. Here is an example of a smooth horizontal text scroller using a kind of GRAM card shifting. Note that it relies on JLP memory support. There may be room for improvements, in particular if the soft font (stolen from MINIGROM) is swapped around, one can save a little bit of code. I'm sure if you break out parts of it into assembly language, you can improve it even more. textscroll.bas Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 8, 2022 Share Posted January 8, 2022 4 minutes ago, carlsson said: So instead of going to sleep, I decided to try this. Here is an example of a smooth horizontal text scroller using a kind of GRAM card shifting. Note that it relies on JLP memory support. There may be room for improvements, in particular if the soft font (stolen from MINIGROM) is swapped around, one can save a little bit of code. I'm sure if you break out parts of it into assembly language, you can improve it even more. textscroll.bas 9.47 kB · 2 downloads Wow! Well done! I would have made it in a very complicated way! ? Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 8, 2022 Share Posted January 8, 2022 By the way, would DEFINE + DEFINE ALTERNATE help me to get 20 GRAM in one frame? I tried it but didn't get it to work properly so I split it into two calls. Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 8, 2022 Share Posted January 8, 2022 3 minutes ago, carlsson said: By the way, would DEFINE + DEFINE ALTERNATE help me to get 20 GRAM in one frame? I tried it but didn't get it to work properly so I split it into two calls. It isn´t possible to define more than 16 GRAM in one frame because of timing constraints, even if you used this combination. 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 8, 2022 Share Posted January 8, 2022 I see. Of course one doesn't have to use the entire screen width for a scroll text. If you create a "window" (graphically) you could have your text within say 14 or 16 characters, perhaps centered and in theory get twice the speed. Of course all improvements are left as an exercise for the reader at this stage. 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 8, 2022 Share Posted January 8, 2022 Here is a new version, using a 6 pixel wide font. It means I can pack more scrolling characters on the screen. I also reduced text scroll width to 16 columns in order to fit it within one DEFINE. As a hobbyist demo coder, I'll admit the scroller is a bit jerky. I think even more careful timing and probably moving to pure assembly code would be required to get it even better. Hopefully someone is entertained by this. I might use it in some program later, e.g. for a title screen. textscroll-6px.bas 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.