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:
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:
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.