Moninpeli jossa syödään jotakin ruskeaa mömmöä.
pelaaja yksi liikkuu numpadin numeroilla ja kakkospelaaja kirjaimilla (w,s,a,d).
NÄPYTYS ON VALTTIA!
pitäisi toimia, mutta jos on huomauttamista niin kertokaa
CLS SCREEN 13 WINDOW (0, 0)-(320, 200) DIM p1(15, 15) DIM p2(15, 15) DIM food(15, 15) CONST true = 1 CONST false = 0 LINE (0, 0)-(15, 15), 10, BF LINE (3, 3)-(12, 12), 2, BF GET (0, 0)-(15, 15), p1 LINE (0, 0)-(15, 15), 12, BF LINE (3, 3)-(12, 12), 4, BF GET (0, 0)-(15, 15), p2 CLS CIRCLE (7, 7), 7, 6 PAINT (7, 7), 6 GET (0, 0)-(15, 15), food CLS PUT (x, y), p1 PUT (x + 50, y), p2 PUT (x + 100, y), food CLS score = 0 '''''''''''''''''''''''''valmistellaan peli INPUT "Anna pistemäärä mihin pelataan:"; set '''''''pisteet score2 = 0 PUT (x, y), p1 PUT (285, 135), p2 p1y = 0 p1x = 0 p2x = 285 p2y = 135 DO UNTIL score = set OR score2 = set OR INKEY$ CHR$(27) 'lopetetaan peli jos on painettu esciä tai pisteet tulee täyteen 'peli alkaa tästä LOCATE 1, 1 PRINT "p1 score:"; score; "p2 score:"; score2 '''kirjoitetaan pisteet LINE (0, 0)-(300, 150), 2, B IF food = false THEN randomy = INT(RND * 10) * 15 randomx = INT(RND * 19) * 15 PUT (randomx, randomy), food food = true END IF KEY$ = INKEY$ SELECT CASE KEY$ ''''''''aloitetaan näppäinten lukeminen CASE "w" IF p1y < 135 THEN PUT (p1x, p1y), p1 p1y = p1y + 15 PUT (p1x, p1y), p1 END IF IF p1x = randomx AND p1y = randomy THEN food = false score = score + 1 PUT (randomx, randomy), food END IF CASE "s" IF p1y > 0 THEN PUT (p1x, p1y), p1 p1y = p1y - 15 PUT (p1x, p1y), p1 END IF IF p1x = randomx AND p1y = randomy THEN food = false score = score + 1 PUT (randomx, randomy), food END IF CASE "d" IF p1x < 285 THEN PUT (p1x, p1y), p1 p1x = p1x + 15 PUT (p1x, p1y), p1 END IF IF p1x = randomx AND p1y = randomy THEN food = false score = score + 1 PUT (randomx, randomy), food END IF CASE "a" IF p1x > 0 THEN PUT (p1x, p1y), p1 p1x = p1x - 15 PUT (p1x, p1y), p1 END IF IF p1x = randomx AND p1y = randomy THEN food = false score = score + 1 PUT (randomx, randomy), food END IF CASE "8" IF p2y < 135 THEN PUT (p2x, p2y), p2 p2y = p2y + 15 PUT (p2x, p2y), p2 END IF IF p2x = randomx AND p2y = randomy THEN food = false score2 = score2 + 1 PUT (randomx, randomy), food END IF CASE "5" IF p2y > 0 THEN PUT (p2x, p2y), p2 p2y = p2y - 15 PUT (p2x, p2y), p2 END IF IF p2x = randomx AND p2y = randomy THEN food = false score2 = score2 + 1 PUT (randomx, randomy), food END IF CASE "6" IF p2x < 285 THEN PUT (p2x, p2y), p2 p2x = p2x + 15 PUT (p2x, p2y), p2 END IF IF p2x = randomx AND p2y = randomy THEN food = false score2 = score2 + 1 PUT (randomx, randomy), food END IF CASE "4" IF p2x > 0 THEN PUT (p2x, p2y), p2 p2x = p2x - 15 PUT (p2x, p2y), p2 END IF IF p2x = randomx AND p2y = randomy THEN food = false score2 = score2 + 1 PUT (randomx, randomy), food END IF END SELECT''''''lopetetaan näppäinten lukeminen LOOP end '''''''''''lopetetaan peli
tuli pieni virhe kun yritätte aloittaa pelin se herjaa.
lisätkää siihen "DO" käskyyn sinne loppuun vaan = merkki
siellä nimittäin lukee if ... ... or inkey$ chr$(27) then
eli muuttakaa se seuraavanlaiseksi:
if ... ... or inkey$ = chr$(27) then
silloin sen pitäisi toimia...
Aihe on jo aika vanha, joten et voi enää vastata siihen.