How To

Convert text games from LowRes Coder to NX

2

Timo 2018-10-17 09:25 (Edited)

Did you make text games based on PRINT and INPUT in the old LowRes Coder app? They are super easy to convert to LowRes NX, because text and logic commands work almost identically in both systems. Let’s bring your games to NX!

At first just copy and paste your original code to a new NX program. If you are very lucky, it may already work somehow, but probably we have to change some things. At first we will just make it work, even though we may lose some things. Later we can improve the new version.

Let’s do this step by step. If you don’t know what a step is talking about, just skip it, probably you don’t need it.


1. The graphics system of NX is very different from LowRes Coder, so we have to remove all drawing commands like PLOT, LINE, PAINT etc., as well as COLOR. Keep text commands like PRINT, INPUT, TEXT and CLS.

2. LowRes NX has a fix screen resolution, so we also have to remove DISPLAY and LAYER related commands.

3. FONT works differently in NX and is probably not what you want, let’s just remove it.

4. The TEXT command in NX works with text columns and rows instead of pixels. One character has a size of 8x8 pixels, so we have to divide the coordinates by 8. The optional parameters after the string are not available in NX, they have to be removed.

5. The WAIT command in LowRes Coder waits seconds, in NX it waits frames (1/60 seconds). The easiest way to fix this is to multiply, for example change “WAIT 3” to “WAIT 3*60”.

6. WAIT BUTTON is not available in NX. We can replace it with a simple “INPUT A”, so the player has to press Return to continue. “A” is just a variable name, change it if you use it already in your code.

7. Sound works very different in NX. Let’s disable all sound commands for the moment by writing REM or an apostrophe (') at the beginnings of lines.

8. Replace TRUE with -1 and FALSE with 0. If you wrote something like “IF A=TRUE THEN”, replace it simply with “IF A THEN”. “IF A=FALSE THEN” should be written as “IF NOT A THEN”.

9. In NX we cannot add a number variable to a string, for example:
PRINT “SCORE “+SCORE
We have to convert the number to a string:
PRINT “SCORE “+STR$(SCORE)

10. There are no persistent variables in NX. We have to remove all PERSIST commands and the PERSIST keyword from DIM (but don’t remove the DIM commands completely).


Does your program work now in LowRes NX? Congratulations! The next time we will talk about, how you can make your game prettier. If you have any problems, just ask.


Toddl 2018-10-31 12:24 (Edited)

Regarding TRUE and FALSE: while converting it's probably way easier to just add these two lines at the start of your program:
TRUE = -1
FALSE = 0


Toddl 2018-10-31 12:25

Regarding PRINT:
replacing the + with a ; should work also IMHO


Timo 2018-10-31 12:31

Toddl, you are right:
PRINT "SCORE "+SCORE
can be converted to:
PRINT "SCORE ";SCORE
It won't concatenate strings, but simply print one value after another.


Log in to reply.