05-11-2004, 11:26 PM
Im in the process of making a Pac Man game and I need some help. I finally got the Pac Man to move but I have a couple problems...
- I cant keep the Pac Man from going through walls
- I cant make the Pac Man eat the dots(it goes through it)
Here is my program so far(Keep in mind I have very very very basic Qbasic knowledge):
I tried to make it so that Pac Man couldnt move if it was in a certain color but that idea went down the drain because i didnt know how to set it. As for the dot eating problem..i have no clue on how to go about it...I thought the circles were supposed to automatically disappear if the bigger circle went over it...
Any help would be appreciated..
-edit- sorry if this is in the wrong section
- I cant keep the Pac Man from going through walls
- I cant make the Pac Man eat the dots(it goes through it)
Here is my program so far(Keep in mind I have very very very basic Qbasic knowledge):
Quote:CLS
LOCATE 15, 35
COLOR 4
PRINT "Stage 1"
SLEEP 2
CLS
'PAC MAN GAME
SCREEN 7, 0, 2, 2
DIM pac(90)
REM pacman
CIRCLE (20, 20), 5, 6
PAINT (20, 20), 9, 6
GET (10, 10)-(30, 30), pac(10)
CLS
SCREEN 7, 0, 1, 2
x = 10
y = 10
DO
CLS
REM borders
LINE (20, 30)-(30, 170), 13, BF
LINE (50, 30)-(60, 220), 13, BF
LINE (80, 20)-(220, 30), 13, BF
LINE (80, 50)-(130, 60), 13, BF
LINE (80, 110)-(90, 140), 13, BF
LINE (80, 180)-(90, 220), 13, BF
LINE (170, 50)-(300, 60), 13, BF
LINE (110, 180)-(190, 190), 13, BF
LINE (110, 210)-(190, 220), 13, BF
LINE (230, 80)-(240, 220), 13, BF
LINE (260, 80)-(300, 90), 13, BF
LINE (260, 110)-(270, 170), 13, BF
LINE (290, 110)-(300, 170), 13, BF
LINE (260, 190)-(300, 200), 13, BF
LINE (110, 80)-(120, 160), 13, BF
LINE (110, 80)-(140, 100), 13, BF
LINE (110, 150)-(210, 160), 13, BF
LINE (200, 80)-(210, 160), 13, BF
LINE (180, 80)-(210, 100), 13, BF
'dots
FOR z = 20 TO 185 STEP 7
PSET (40, z), 7
NEXT z
FOR q = 20 TO 185 STEP 7
PSET (70, q), 7
NEXT q
FOR e = 80 TO 300 STEP 7
PSET (e, 40), 7
NEXT e
FOR r = 80 TO 300 STEP 7
PSET (r, 70), 7
NEXT r
FOR u = 80 TO 220 STEP 7
PSET (u, 170), 7
NEXT u
REM direction controller
k$ = INKEY$
IF k$ = CHR$(0) + CHR$(72) AND y > 10 THEN y = y - 5
IF k$ = CHR$(0) + CHR$(80) AND y <= 165 THEN y = y + 5
IF k$ = CHR$(0) + CHR$(77) AND x <= 280 THEN x = x + 5
IF k$ = CHR$(0) + CHR$(75) AND x > 10 THEN x = x - 5
PUT (x, y), pac(10)
PCOPY 1, 2
LOOP UNTIL k$ = "q" OR k$ = "Q"
CLS
I tried to make it so that Pac Man couldnt move if it was in a certain color but that idea went down the drain because i didnt know how to set it. As for the dot eating problem..i have no clue on how to go about it...I thought the circles were supposed to automatically disappear if the bigger circle went over it...
Any help would be appreciated..
-edit- sorry if this is in the wrong section