10-26-2004, 02:50 AM
im making the standered newbie pac-man game in text mode.
i added a few things here and there that arn't in the tut.
um but mainly my counter thing called "pellets" arnt working right.
ill post the code.
you can see im missing the actual code for the counter"pellets" but that is because i dont know how. Do i go like this:
IF "C" = "*" then pellets = pellets - 1
i tried that and it doesnt work what should i do?
i added a few things here and there that arn't in the tut.
um but mainly my counter thing called "pellets" arnt working right.
ill post the code.
Code:
CLS
LOCATE 7, 20
PRINT "PAC-MAN"
SLEEP 2
CLS
DIM pellets AS INTEGER
game:
CLS
y = 2
x = 1
grow% = 6
gcol% = 8
COLOR 4
PRINT "0000000"
PRINT " * * *"
PRINT "0*000*0"
PRINT "0 0?0 0"
PRINT "0* * *0"
PRINT "0 000 0"
PRINT " * 0 * "
PRINT "0 * * 0"
PRINT "0000000"
pellets = 13
DO
a$ = INKEY$
checky = y: checkx = x
LOCATE y, x: COLOR 0: PRINT "C" 'print nothing were pacman will be.
LOCATE 8, 6: COLOR 0: PRINT "G" ' print nothing were ghost will be
IF a$ = CHR$(0) + CHR$(72) AND y - 1 > 0 THEN checky = y - 1 'movment and clipping
IF a$ = CHR$(0) + CHR$(75) AND x - 1 > 0 THEN checkx = x - 1
IF a$ = CHR$(0) + CHR$(80) THEN checky = y + 1
IF a$ = CHR$(0) + CHR$(77) THEN checkx = x + 1
IF x > 7 THEN x = 7
IF SCREEN(checky, checkx) <> 48 THEN 'more clipping
x = checkx
y = checky
END IF
LOCATE y, x: COLOR 4: PRINT "C" 'now we really print pac-man
LOCATE 8, 6: COLOR 5: PRINT "G" ' now we really print ghost
IF x = grow% AND y = gcol% THEN GOTO music ' if pac-man hits ghost then goto music
IF x = 7 AND y = 2 THEN x = 1 AND y = 2 'portal upper
LOCATE 2, 7
PRINT " "
IF x = 7 AND y = 7 THEN x = 1 AND y = 7 ' portal lower
LOCATE 7, 7
PRINT " "
IF pellets = 0 THEN 'counter
LOCATE 13, 42
PRINT "YOU WIN"
END IF
IF y = 4 AND x = 4 THEN ' collision with Power Pellet
LOCATE 11, 20
PRINT "POWER PELLET"
END IF
LOOP UNTIL a$ = CHR$(27)
IF a$ = CHR$(27) THEN
END
END IF
music:
CLS
LOCATE 10, 10
COLOR 3
PRINT "YOU GOT EATEN!!"
PLAY "agfedc"
END
you can see im missing the actual code for the counter"pellets" but that is because i dont know how. Do i go like this:
IF "C" = "*" then pellets = pellets - 1
i tried that and it doesnt work what should i do?