BBC BASIC for Windows
« CLS specific co-ordinates »

Welcome Guest. Please Login or Register.
Apr 6th, 2018, 12:02am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: CLS specific co-ordinates  (Read 379 times)
Usama Amin
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 18
xx CLS specific co-ordinates
« Thread started on: Oct 19th, 2012, 9:20pm »

Hey guys,
I'm new to programming and i've started to make a Space invaders game and wanted to know if there's any way to clear only a row (e.g. Row 23 or something)? smiley
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: CLS specific co-ordinates
« Reply #1 on: Oct 20th, 2012, 09:18am »

on Oct 19th, 2012, 9:20pm, usamaamin786 wrote:
I'm new to programming and i've started to make a Space invaders game and wanted to know if there's any way to clear only a row (e.g. Row 23 or something)? :)

If you're working with text coordinates the easiest way is probably to overwrite the row with spaces. So if the text viewport is 80-characters wide you could do:

Code:
      PRINT TAB(0,23) SPC(80); 

That will clear the row to the current text background colour. If you've switched into the 'write text at graphics cursor' mode (VDU 5) you will need to temporarily switch back to VDU 4 mode to make it work:

Code:
      VDU 4
      PRINT TAB(0,23) SPC(80);
      VDU 5 

Or even combine everything into a single PRINT:

Code:
      PRINT CHR$(4) TAB(0,23) SPC(80) CHR$(5); 

Another way is to temporarily set a text viewport covering the row(s) you want to clear, and then do a CLS (VDU 12). Afterwards you can restore the text viewport to the entire window (VDU 26) or set a new one:

Code:
      VDU 28,0,23,79,23,12,26 

If you're working with graphics coordinates then you can clear the row using a RECTANGLE FILL, for example:

Code:
      RECTANGLE FILL 0,0,1280,40 

That will clear the bottom row to the current graphics foreground colour (assuming a width of 640 pixels and a row height of 20 pixels).

Richard.
« Last Edit: Oct 20th, 2012, 09:28am by admin » User IP Logged

Usama Amin
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 18
xx Re: CLS specific co-ordinates
« Reply #2 on: Oct 21st, 2012, 09:14am »

Thanks!
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls