ZX Computings - OpenLibra
ZX Computings - OpenLibra
ZX Computings - OpenLibra
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
—<br />
32) limiting the firing to ten shots,<br />
037ADHK0 one on each key to keep it fair.<br />
The shots information is held<br />
2 0E$(1) by S$. We must now fire in<br />
2J2; theorder 0,1,2,3 - 9. Add to<br />
" AND C = 0; ma'" program:-<br />
IDC>0; "=]<br />
DDE C$(A +1 20 LETSS = "0"<br />
" 160 IFA$S$ THEN<br />
GOTO 120<br />
300 LET SS = STR$(VAL<br />
S$ + 1)<br />
e program we3 IF S$ = "10" THEN<br />
„ subtleties B GOTO 330<br />
UMMER 1983 z x COMPUTING SUMMER 1982<br />
We also wish to display the<br />
overall "hit points" = H and<br />
each time the target moves<br />
we clock up "TIME" « T.<br />
Add to main prograrn:-<br />
40 LET H = 0<br />
50 LET T = 0<br />
140 LET T = T + 1<br />
270 LETH = H + C* 10<br />
280 PRINT AT 15,22;<br />
"TIME = "; T; AT<br />
1 7,22;"SH0T = ";S$;<br />
AT 1 9,18;"HIT PTS. = "<br />
;H<br />
POKElng<br />
330 PRINT AT 0,0;E$(1)<br />
340 PRINT AT 0,6;"HIT<br />
POINTS (-} TIME"<br />
350 PRINT AT 2,6;<br />
"OVERALL SCORE OF"<br />
360 PRINT AT 4,1 3;H-T<br />
370 IF H-T>300 THEN<br />
PRINT AT 8,10;"WELL<br />
DONE"<br />
380 IF H-T>400 THEN<br />
PRINT AT 8,10;"VERY<br />
GOOD"<br />
400 IF INKEY$ < > ""THEN<br />
GOTO 400<br />
410 IF INKEY$ =""THEN<br />
GOTO 410<br />
420 CLS<br />
430 RUN<br />
The object is now to try and<br />
beat the 500 score using the<br />
keys in order 0 - 9. To<br />
complete the programme a<br />
title and instructions should be<br />
written in, at lines 440<br />
upwards and end with a<br />
GOTO 400 instruction.<br />
Rather than fill a string full<br />
of blanks why not DIM (1,32),<br />
this makes the machine do the<br />
work for us. Then use String<br />
(1).<br />
To extend on this idea why<br />
not DIM a string (1.3 52) if we<br />
now print this at 0,0; we will<br />
clear the top half of the<br />
screen. Also if we print this<br />
String (1) at 11,0; we will<br />
clear the bottom half of the<br />
screen.<br />
A simple way to print a<br />
picture quickly is to print it via<br />
a String. The easiest way is to<br />
draw this picture on squared<br />
paper. Then type in a direct<br />
command FAST. Then line<br />
number for example:-<br />
10 LET A$ = "<br />
this is now followed by the<br />
rest of line being blanks.<br />
So the first line is filled with<br />
blanks then the picture can be<br />
drawn in the normal manner as<br />
seen on the screen. When the<br />
picture is complete end the<br />
quotes then new line. We can<br />
now edit this line, rub out the<br />
unwanted blanks at the<br />
beginning and new line to<br />
have our required picture in<br />
the correct positioning.<br />
Try this simple program:-<br />
10 FAST<br />
20 LET A$ = " "<br />
30 LET B$ =" "<br />
40 LET C$ =" "<br />
50 FOR X = 1 TO 666<br />
60 LET A$ = A$ + CHR$<br />
((RND< 0.11 # 24)<br />
70 LET 8$ =B$ +CHR$<br />
{(RND