How To

What’s the difference between CLS and CLW ?


G-9 2020-09-14 10:43

was8bit 2020-09-14 11:25 (Edited)

CLS is a standard command, by itself it will entirely erase both backgrounds, from 0,0 to 31,31 (backgrounds are technically bigger than the visible portion)

To entirely clear just one background, add the specific background #... CLS 0 will swipe clean the entire top layer (BG 0)

CLW relates to a special set of PRINT commands... by default, when you use PRINT, NX assumes you want to print content to the entire visible screen, and uses the background last set by the BG command... the visible screen is 0,0 to 19,15

When you use CLW, by default then, it will only clear the area 0,0 to 19,15 leaving the remaining portion of the 0,0 to 31,32 of the BG untouched

This isnt a special layer, just a special way to control how PRINT works...

WINDOW overrides the default setting, allowing you to restrict the area PRINT will print to... LOCATE sets where the PRINT will start printing to.. as you keep using the PRINT command, it automatically updates where it prints to, and you can pinpoint where it iwll print to next using the CURSOR commands....

was8bit 2020-09-14 11:29 (Edited)

Unless you are making a text only kind of game, it is actually just easier to use TEXT and CELL to graphically create your screen...

But, if you are making a text only game, with tons of PRINT statements, these commands can be great! For example, you can have 2 output areas, and print stuff that restricts itself to the top part of the screen, and then print other stuff that restricts itself to the bottom of the screen... PRINT, then, will autoscroll the text for you inside the defined area :)

CLW, in this case, would clear only the area you defined :)

was8bit 2020-09-14 11:37

Another application is if you are using BG 1 to display a scrollable map, but then want a pop up message box to occaisonally appear in BG 0, but dont want it to completely obscure or cover up the map.. using the special PRINT comands make it easy to use PRINT and yet keep all the text inside your little pop up box, and NX will auto scroll the text for you inside your message box :)

G-9 2020-09-14 13:53

Thank you so much 😊

was8bit 2020-09-14 14:02

Glad i could help :)

Log in to reply.