Back in the day there was a type-in in one of the mags called Beach Comber. Simple stuff, but I proudly showed it off to everyone. So I thought I'd try to recreate it. And Copilot did a fine job of the code. It knew that the cursors were keys 5,6,7 and 8. It knew the dimensions of the Spectrum screen. It needed to be prompted to put If..Then conditions all onto one line seperated by colons, and that its 'goto' and not 'go to'. Also I couldn't convince it that comments had to be rem lines and not semi-colons. Otherwise, top stuff. I really will be out of a job in a few years.
Prompts :
Spoiler
can you add code so that the player cannot move outside the bounds of the screen?
there is also a line of dashes that run horizontally across the screen . this line starts at the top of the screen, and then moves down the screen until 3/4 of the way down. it then reverses and moves back up to the top of the screen, before moving down again . It moves all the time and does not wait for player input. Can you add this to the code please?
thankyou. The players score starts at zero, and is shown at the top of the screen.. there is a gold coin on the screen which is represented by the letter 'O'. It appears at a random spot. If the player moves over the coin, the coin reappears at a random place on the screen, and the players score increases by one.
hi. thats almost correct. In sinclair spectrum basic, if you have a if statement that is true, all the statements that are carried out must be on the end of the line seperated by a colon.
hi. the line currently moves up and down the screen. Can you also set it so that it reverses each turn with a 1 in 20 chance?
Can you only show the location of the coin if it is below or equal to the line. If it is above the line then do not show it.
If the player is above the line , then the game should end. A message should say "Game over!" and the player's score should be printed. The code can then stop.
hi. in sinclair basic, comments begin with a rem statement and not a comma
can you give me the code without commens please?
last thing. On line 210, the basic command "go to" is one word, so should be goto.
Spoiler
20 LET lx=0: LET ly=0
30 LET dir=1
40 LET score=0
50 LET cx=INT (RND*32)
60 LET cy=INT (RND*24)
70 PRINT AT 0,0; "Score: "; score
80 PRINT AT y,x;"*": PRINT AT ly,lx;"--------------------------------"
90 IF ly<=cy THEN PRINT AT cy,cx;"O"
100 PAUSE 5
110 IF INKEY$="7" AND y>0 THEN LET y=y-1
120 IF INKEY$="8" AND x<31 THEN LET x=x+1
130 IF INKEY$="6" AND y<23 THEN LET y=y+1
140 IF INKEY$="5" AND x>0 THEN LET x=x-1
150 IF ly=17 OR ly=0 THEN LET dir=-dir
160 IF RND < 0.05 THEN LET dir=-dir
170 LET ly=ly+dir
180 IF x=cx AND y=cy THEN LET score=score+1: LET cx=INT (RND*32): LET cy=INT (RND*24)
190 IF y<ly THEN PRINT "Game over! Your score is: "; score: STOP
200 CLS
210 GOTO 70
Now.... It doesn't quite work for some reason. The IF Statements on lines 90, 150 and 190 never seem to become true, whereas 160 and 180 do. But I'm out of lunch hour to check why, but its probably minor.