Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 10 REM ZX Spectrum BASIC Game
- 20 PRINT "Welcome to the ZX Spectrum Game!"
- 30 PRINT "Use the cursor keys to move the player."
- 40 PRINT "Press SPACE to shoot."
- 50 PRINT "Avoid the enemy and try to score as many points as possible."
- 60 PRINT "Press ENTER to start."
- 70 PAUSE 0
- 80 CLS
- 90 LET x = 12
- 100 LET y = 18
- 110 LET score = 0
- 120 LET enemyx = RND * 22
- 130 LET enemyy = RND * 16
- 140 PRINT AT y,x;"@"
- 150 PRINT AT enemyy,enemyx;"X"
- 160 LET k$ = INKEY$
- 170 IF k$ = CHR$ 8 THEN LET x = x - 1
- 180 IF k$ = CHR$ 9 THEN LET x = x + 1
- 190 IF k$ = CHR$ 10 THEN LET y = y - 1
- 200 IF k$ = CHR$ 11 THEN LET y = y + 1
- 210 IF k$ = " " THEN GOSUB 300
- 220 PRINT AT y,x;" "
- 230 PRINT AT enemyy,enemyx;" "
- 240 IF ABS(x - enemyx) < 2 AND ABS(y - enemyy) < 2 THEN GOTO 350
- 250 LET enemyx = RND * 22
- 260 LET enemyy = RND * 16
- 270 GOTO 140
- 300 REM Shoot
- 310 FOR i = 1 TO 5
- 320 PRINT AT y - i, x + 1;"*"
- 330 PAUSE 5
- 340 NEXT i
- 350 REM Game Over
- 360 CLS
- 370 PRINT "Game Over. Your score is: ";score
- 380 STOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement