Jump to content
IGNORED

Pac_Man Eat n Run


Lewis2907

Recommended Posts

Edited as of 29 Nov 2023. Updates in Blue. I will post new edits here to make it easier as I'm pretty much gotten as far as i can until i get the Atari 2600+ or get my old real hardware fixed. 

 

Thanks to RT and atari2600land's Batari Man! plus the other stuff I found online at Bb. I have been working on "PacMan Eat N Run" homage to the Pac Man Table Top version around 1981. I had the tabletop version as a kid and loved that game. Just never really saw  it again to play online.

 

;```````````````````````````````````````````````````````````````
;
; Instructions / Gameplay:
;

; You play as the long time favored Pacman trying to rescue Ms. Pacman. You start with 3 lives and can gain an extra life at 20, 35 & 50 points. There are 25 rooms total in the Maze
; Use the joystick to move around and eat the fruit and run as there are no Power Pellets. The goal is to make it to the center room / map and save Ms. PacMan.

;

; Overall Gameplay there are some slight variations in DPC & Multisprite: 

; Use the left joy stick to move PacMan around.

; Glide along the walls to find the exit to the next room. (DPC Version exits are closed, Multisprite they are open)
; Use Select switch to Pause Game. Press the fire button to resume the game.
; Use BW switch to bring up the Map. Use the Color switch close Map.

; Use the Left Switch A for PacMan to restart at the beginning of the game / original room. (Hard Mode)

; Use the Left Switch B for PacMan to just run over the Ghosts and not be reset to the beginning of the game / original room. (Easy Mode)

; Use the Right Switch A to disable the Map. (Hard Mode)

; Use the Right Switch B to enable the Map. (Easy Mode)

; Multisprite: Collect Coins to gain 10 points. 

; Extra Life at 30, 60, 90 points.

; Fruits. There are 8 Fruits to collect.

; Game Over screen if you loos all lives. 

;

; DPC: Collect fruit to gain 5 points. 

; Extra Life at 20, 35, 50 points.

; Fixed the "pause" to mirror the look of the Multisprite version.

; Currently works on the below:

; Stella 4.7 from 2016

; 2600.emu built 26 Aug 2023 using an Android Phone

; No real hardware to test the game (yet). 

; Working to make sure it works on the 2600+ (Should have one in Dec 2023 self X Mass Present lol from my grandkids)

;

; Future plans:

; Multisprite: About 95% complete. Figure out how to track collecting all 8 Fruits then unlock Ms. PacMan. Ending for winning the game. Fixed the

; slight jittering here and there (probably scaling issues).

; DPC: About 90% complete. Reduce the code some to incorporate the Multisprite elements like the fruits. 

;

; Standard Kernel: Attempt to do a Standard Kernel version. I saw an example  on how to make a  a few sprites "appear" on the screen at the same time. That will be a challenge.

; Port these over to 7800 basic as I have just started to learn how to code some there.

; Please provide feedback as always.

;

; About me:

; Darrell Lewis aka Lewis2907. I started using Batari Basic back on 27 Nov 2015 while deployed to Afghanistan a second time. Now I'm a LTC in the Army Reserves.

; I was finally able to find something I could understand and sort of self teach myself since it was similar to Basic I learned in elementary school back in the 80's.

; Now I have been able to experiment and learn to make some games. Thanks to everyone who has helped me learn along the way.

 

The YouTube Table Top PacMan Video

 

 

 

 

20231126 - PacMan_Eat_N_Run_Multisprite.bas.bin

20231129_Pacman_Eat_n_Run_DPC.bas.bin

Edited by Lewis2907
29 Nov 2023 Update.
  • Like 10
Link to comment
Share on other sites

I've been adding an extra "drawscreen" calls in problem areas in my game. It seems to fix the problem most of the time, but what is the best practice?

 

I have a situation where the game loops an indeterminate number of times and it could take longer or shorter. Do I just sprinkle more "drawscreen" in there, or do I actually have to let the kernel cycle through to the next frame on its own?

Link to comment
Share on other sites

Not sure if this the answer. But just a glance of what found it seems to be the pfline to make it go over 262. So I'm thinking maybe switching to pixel may work. Also that using Stella only may or may not catch flicker and screen jitter. Just a thought unless someone who knows more can explain it.

Link to comment
Share on other sites

Very cool game! Bravo!

 

On the rippin' arsed scanline count I would say to go in where a massive amount of gosubs are happening (all over the place really), and maybe make a loop with a timer inside (for instance, on the 'game over' screen where gosubs grab the graphics for each segment). When they come back with their data it's pushing into the display time. A continuous, counter driven loop would take away the burden of so many gosubs. I've only briefly scanned over this and am really just grabbing at what pops up immediately and that's WOAH GOSUB into the NIIIIIIGHT!!

 

Really neat and seemingly iconic BASIC style reminiscent of old programming books. KEWL... (I'm a caveman.)

Link to comment
Share on other sites

Very cool game! Bravo!

 

On the rippin' arsed scanline count I would say to go in where a massive amount of gosubs are happening (all over the place really), and maybe make a loop with a timer inside (for instance, on the 'game over' screen where gosubs grab the graphics for each segment). When they come back with their data it's pushing into the display time. A continuous, counter driven loop would take away the burden of so many gosubs. I've only briefly scanned over this and am really just grabbing at what pops up immediately and that's WOAH GOSUB into the NIIIIIIGHT!!

 

Really neat and seemingly iconic BASIC style reminiscent of old programming books. KEWL... (I'm a caveman.)

Papa,

 

Thanks for the tips. I have been looking at what you post and they well above what I can accomplish. I'm still not there yet. I just started Bb last Oct 2015 while I was in Afghanistan. I have came a long ways but still have more to learn. As for the BASIC style you are correct. I learned how to use Basic on the old Apple II by doing CTRL ALT BREAK and some of the old school LOGO. I understand now what everyone is saying about the gosubs I have and I plan to go back and read what RT sent as well.

 

Not sure if someone could make a "video" on how to make simple title screens and or music. I am more a visual person than reading when it becomes more detailed. I'm still learning that as well which is hinder some progress on the next homage game I am working on.

Link to comment
Share on other sites

Papa,

 

Thanks for the tips. I have been looking at what you post and they well above what I can accomplish. I'm still not there yet. I just started Bb last Oct 2015 while I was in Afghanistan. I have came a long ways but still have more to learn. As for the BASIC style you are correct. I learned how to use Basic on the old Apple II by doing CTRL ALT BREAK and some of the old school LOGO. I understand now what everyone is saying about the gosubs I have and I plan to go back and read what RT sent as well.

 

Not sure if someone could make a "video" on how to make simple title screens and or music. I am more a visual person than reading when it becomes more detailed. I'm still learning that as well which is hinder some progress on the next homage game I am working on.

 

 

you don't necessarily have to avoid gosubs but you will want to avoid switching banks if you don't have to

you've got a string of gosubs to bank6

__Return_From_Map 
   gosub draw_room
   gosub __PacMan_Color bank6
   gosub __Red_Ghost_Color bank6 
   gosub __Pink_Ghost_Color bank6 
   gosub __Blue_Ghost_Color bank6
   gosub __Orange_Ghost_Color bank5 
   player9y = 250 ; Map PacMan off Screen

don't do that

 

jump into bank6 do your gosubs (and specify "thisbank" for both gosubs and returns) and then jump bank

 

bank switches cost

 

 

having said that, there's other things you could do to speed up your code

Edited by bogax
Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the tips. I brought the scanlines down from 270 to 276. I hit 263 to 265 when I try to exit the screen. if someone can assit me with some of the gosubs that would be great. If not I will go back to the open concept.

 

I did make some improvements:

 

1. 3 lives to start with or use the left switch at the titles screen to start with one.

2. The Fruit shouldn't hit the playfield and be on different horizontal lines to reduce flicker.

3. The game over screen is better but mimics the start screen (WIP).

4. The game can now end in room 12 by getting the jack-o-lantern.

5. Freed up more space in the banks

 

Future improvements:

 

1. To reduce the scanlines

2. Better Gameover / Ending the Game Screen

3. Learn the title screen

4. Learn Music for the gameover and ending game screen

5. Learn more Bb. This will lead into what I have in mind to make next. That will be a challenge in it's self.

 

As always I welcome any and all commnets, thanks.

Pac_Man_Eat_and_Run - 05 Oct 16 (DPC+).txt

default.bas.bin

  • Like 2
Link to comment
Share on other sites

I made a gifeo of the game in action, there are 2 play throughs:

 

post-24767-0-06870700-1475710685_thumb.gif - click to animate.

 

I really love the concept of exploring, eating a few fruit, and then nudge the wall to proceed to the next room. The game is pretty buggy and wonder why no fruits are not appearing when I go through more than 2 rooms.

Edited by Kiwi
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Thanks. I am still trying to figure out a way to stop the scalines. I did fix the fruit issue and made better mazes. Also working on a few other things for this game. But all the praise should go to Random Terrain, Atari2600land and a few others as I used their code and merged it together to make this game.

Link to comment
Share on other sites

Thanks. I am still trying to figure out a way to stop the scalines. I did fix the fruit issue and made better mazes. Also working on a few other things for this game. But all the praise should go to Random Terrain, Atari2600land and a few others as I used their code and merged it together to make this game.

 

 

there are some odd things about your code
the first odd thing is that you waste time (and code) on all those if tests
edit: oops you do go to those labels
fixed the example
suppose you're in room 1
you don't call any of those labels from anywhere so the only way to get
to a test for room 1 is to fall through all those if tests
but you goto __Exit_Return after the first block of ifs so
how will you ever get to the if room = 1 test if you're in room 1?
in the third block of ifs you test player0x > 130 except for room 8 where it's
132 is that what you meant to do?
you do something only if player0x = 76 || player0y = 82
so why not test for that and bug out if they fail, and not spend time (and code)
on tests you don't need?
 
__Pac_Man_Exit_Top
   if room = 0 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 4 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 5 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 6 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 7 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 8 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 9 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 10 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 11 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 13 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 14 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 15 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 18 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 19 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   goto __Exit_Return
 
__Pac_Man_Exit_Bottom
   if room = 15 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 14 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 16 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 24 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 21 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 19 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 18 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 5 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 10 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 9 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 11 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
 
   ; Set CTRLPF so light sprite moves behind playfield. using 9 moves player9 behind the playfield.
   if room = 12 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom  
   goto __Exit_Return
 
__Pac_Man_Exit_Right
   if room = 0 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 1 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 3 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 6 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 7 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 8 && player0x = 132 && player0y = 82 then goto __Unblock_Right
   if room = 13 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 16 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 17 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 18 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 19 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 20 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 21 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 22 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   goto __Exit_Return
 
__Pac_Man_Exit_Left
   if room = 1 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 2 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 4 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 5 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 6 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 7 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 14 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 15 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 16 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 18 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 17 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 20 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 21 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 22 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 24 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 23 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   goto __Exit_Return
here's some example code (I don't promise it's right)
I put flags in a look up table for the room test
the room test(s) only happen after determining that the other
conditions are met
(I've asssumed that the room 8 player0x-unblock_right test was ment to be 130)
  temp1 = exit_flags[room]
  if player0x <> 76 || player0y >= 15 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{0} then goto __Unblock_Top  
  goto __Exit_Return
 
__Pac_Man_Exit_Bottom
  if player0x <> 76 || player0y <= 140 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{1} then goto __Unblock_Bottom  
 
skip_to_Exit_Return
  goto __Exit_Return
 
__Pac_Man_Exit_Right
  if player0y <> 82 || player0x >= 130 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{2} then goto __Unblock_Right  
  goto __Exit_Return
 
__Pac_Man_Exit_Left
  if player0y <> 82 || player0x >= 21 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{3} then goto __Unblock_Left  
  goto __Exit_Return
 
  data exit_flags
  %00000101, %00001100, %00001000, %00001100, %00001001, %00001001, %00001101, %00001101, %00000101, %00000011, %00000011, %00000011
  %00000010, %00000101, %00001011, %00001011, %00001110, %00001100, %00001111, %00000111, %00001100, %00001110, %00001100, %00001000
  %00001010
end
for this block of code
I'd suggest you jump into bank6 and use an on..goto statement
to select the draw_room_shape routine
it will take much less code and less time
if you can save room you can fit more in a bank and not have to waste
time doing bank switches
   if room_shape[room] <> 12 then gosub __Pac_Man_Playfield_Colors bank6
 
   if room_shape[room] = 0 then goto draw_room_shape_0 bank6 
   if room_shape[room] = 1 then goto draw_room_shape_1 bank6
   if room_shape[room] = 2 then goto draw_room_shape_2 bank6
   if room_shape[room] = 3 then goto draw_room_shape_3 bank6
   if room_shape[room] = 4 then goto draw_room_shape_4 bank6
   if room_shape[room] = 5 then goto draw_room_shape_5 bank6
   if room_shape[room] = 6 then goto draw_room_shape_6 bank6
   if room_shape[room] = 7 then goto draw_room_shape_7 bank6
   if room_shape[room] = 8 then goto draw_room_shape_8 bank6
   if room_shape[room] = 9 then goto draw_room_shape_9 bank6
   if room_shape[room] = 10 then goto draw_room_shape_10 bank6
   if room_shape[room] = 11 then goto draw_room_shape_11 bank6
   if room_shape[room] = 12 then goto draw_room_shape_12 bank6
   if room_shape[room] = 13 then goto draw_room_shape_13 bank6
   if room_shape[room] = 14 then goto draw_room_shape_14 bank6
   if room_shape[room] = 15 then goto draw_room_shape_15 bank6
   if room_shape[room] = 16 then goto draw_room_shape_16 bank6
   if room_shape[room] = 17 then goto draw_room_shape_17 bank6
   if room_shape[room] = 18 then goto draw_room_shape_18 bank6
   if room_shape[room] = 19 then goto draw_room_shape_19 bank6
   if room_shape[room] = 20 then goto draw_room_shape_20 bank6
   if room_shape[room] = 21 then goto draw_room_shape_21 bank6
   if room_shape[room] = 22 then goto draw_room_shape_22 bank6
   if room_shape[room] = 23 then goto draw_room_shape_23 bank6
   if room_shape[room] = 24 then goto draw_room_shape_24 bank6
Edited by bogax
  • Like 1
Link to comment
Share on other sites

 

 

 

 

 

there are some odd things about your code

 

the first odd thing is that you waste time (and code) on all those if tests

 

edit: oops you do go to those labels

fixed the example

 

suppose you're in room 1

you don't call any of those labels from anywhere so the only way to get

to a test for room 1 is to fall through all those if tests

but you goto __Exit_Return after the first block of ifs so

how will you ever get to the if room = 1 test if you're in room 1?

 

in the third block of ifs you test player0x > 130 except for room 8 where it's

132 is that what you meant to do?

 

you do something only if player0x = 76 || player0y = 82

so why not test for that and bug out if they fail, and not spend time (and code)

on tests you don't need?

 

 

 

 
__Pac_Man_Exit_Top
   if room = 0 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 4 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 5 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 6 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 7 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 8 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 9 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 10 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 11 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 13 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 14 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 15 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 18 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   if room = 19 && player0y < 15 && player0x = 76 then goto __Unblock_Top
   goto __Exit_Return
 
__Pac_Man_Exit_Bottom
   if room = 15 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 14 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 16 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 24 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 21 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 19 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 18 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 5 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 10 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 9 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
   if room = 11 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom
 
   ; Set CTRLPF so light sprite moves behind playfield. using 9 moves player9 behind the playfield.
   if room = 12 && player0y > 140 && player0x = 76 then goto __Unblock_Bottom  
   goto __Exit_Return
 
__Pac_Man_Exit_Right
   if room = 0 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 1 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 3 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 6 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 7 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 8 && player0x = 132 && player0y = 82 then goto __Unblock_Right
   if room = 13 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 16 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 17 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 18 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 19 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 20 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 21 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   if room = 22 && player0x > 130 && player0y = 82 then goto __Unblock_Right
   goto __Exit_Return
 
__Pac_Man_Exit_Left
   if room = 1 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 2 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 4 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 5 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 6 && player0x < 21 && player0y = 82 then goto __Unblock_Left  
   if room = 7 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 14 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 15 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 16 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 18 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 17 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 20 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 21 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 22 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 24 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   if room = 23 && player0x < 21 && player0y = 82 then goto __Unblock_Left
   goto __Exit_Return

 

here's some example code (I don't promise it's right)

I put flags in a look up table for the room test

the room test(s) only happen after determining that the other

conditions are met

(I've asssumed that the room 8 player0x-unblock_right test was ment to be 130)

 

  temp1 = exit_flags[room]
  if player0x <> 76 || player0y >= 15 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{0} then goto __Unblock_Top  
  goto __Exit_Return
 
__Pac_Man_Exit_Bottom
  if player0x <> 76 || player0y <= 140 then  skip_to_Exit_Return
  temp1 = exit_flags[room] : if temp1{1} then goto __Unblock_Bottom  
 
skip_to_Exit_Return
  goto __Exit_Return
 
__Pac_Man_Exit_Right
  if player0y <> 82 || player0x >= 130 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{2} then goto __Unblock_Right  
  goto __Exit_Return
 
__Pac_Man_Exit_Left
  if player0y <> 82 || player0x >= 21 then skip_to_Exit_Return 
  temp1 = exit_flags[room] : if temp1{3} then goto __Unblock_Left  
  goto __Exit_Return
 
  data exit_flags
  %00000101, %00001100, %00001000, %00001100, %00001001, %00001001, %00001101, %00001101, %00000101, %00000011, %00000011, %00000011
  %00000010, %00000101, %00001011, %00001011, %00001110, %00001100, %00001111, %00000111, %00001100, %00001110, %00001100, %00001000
  %00001010
end

 

 

 

 

for this block of code

I'd suggest you jump into bank6 and use an on..goto statement

to select the draw_room_shape routine

it will take much less code and less time

 

if you can save room you can fit more in a bank and not have to waste

time doing bank switches

 

 

   if room_shape[room] <> 12 then gosub __Pac_Man_Playfield_Colors bank6
 
   if room_shape[room] = 0 then goto draw_room_shape_0 bank6 
   if room_shape[room] = 1 then goto draw_room_shape_1 bank6
   if room_shape[room] = 2 then goto draw_room_shape_2 bank6
   if room_shape[room] = 3 then goto draw_room_shape_3 bank6
   if room_shape[room] = 4 then goto draw_room_shape_4 bank6
   if room_shape[room] = 5 then goto draw_room_shape_5 bank6
   if room_shape[room] = 6 then goto draw_room_shape_6 bank6
   if room_shape[room] = 7 then goto draw_room_shape_7 bank6
   if room_shape[room] = 8 then goto draw_room_shape_8 bank6
   if room_shape[room] = 9 then goto draw_room_shape_9 bank6
   if room_shape[room] = 10 then goto draw_room_shape_10 bank6
   if room_shape[room] = 11 then goto draw_room_shape_11 bank6
   if room_shape[room] = 12 then goto draw_room_shape_12 bank6
   if room_shape[room] = 13 then goto draw_room_shape_13 bank6
   if room_shape[room] = 14 then goto draw_room_shape_14 bank6
   if room_shape[room] = 15 then goto draw_room_shape_15 bank6
   if room_shape[room] = 16 then goto draw_room_shape_16 bank6
   if room_shape[room] = 17 then goto draw_room_shape_17 bank6
   if room_shape[room] = 18 then goto draw_room_shape_18 bank6
   if room_shape[room] = 19 then goto draw_room_shape_19 bank6
   if room_shape[room] = 20 then goto draw_room_shape_20 bank6
   if room_shape[room] = 21 then goto draw_room_shape_21 bank6
   if room_shape[room] = 22 then goto draw_room_shape_22 bank6
   if room_shape[room] = 23 then goto draw_room_shape_23 bank6
   if room_shape[room] = 24 then goto draw_room_shape_24 bank6
Link to comment
Share on other sites

Bogax,

 

Thanks. I am playing with the code you gave me. I think I understand the data part you did. The first part works but the rest of the code doesn't. I'm editing it and playing with to see if I can get it to work. Then I will move on to the on gosub. With more space I can move player0 info back into bank2 to reduce time on the gosub. Thanks again for the code. I will try a few more days on this portion. If I can't get it I will ask for help, thanks.

Link to comment
Share on other sites

Does anyone have any ideas on how I can use the on...goto statement that Bogax is referring to. I looked at RT Basic Commands page, I was unable to apply it here. For what I have it might be a little too much for me. If someone can get me started I might be able to learn what is needed and move on. I was able to adapt the "exit flags" that Bogax gave me. Attached are my latest edits to the game. I changed the Red Ghost to same as the other 3 so I can create more complex mazes later. This way the red ghost won't get stuck. Fruit should be in the proper place. I need to add some more code as it tends to get stuck in the playfield every once in a while. You should be able to complete the game. When changing rooms the scanlines go up. Hopefully I can work that issue out. I have a few other plans once I work these out to complete the game at the level of Bb I know. As always comments and suggestions are welcomed, thanks.

 

;****************************************************************
;
; Check Exit Boundries
; temp1 codes provided by Bogax. Adapt if possible for the movement to other rooms

 

temp1 = exit_flags[room]
; Pac_Man_Exit_Top
if player0x = 76 || player0y = 10 then pfpixel 15 0 on : pfpixel 16 0 on
if player0y > 11 then pfpixel 15 0 on : pfpixel 16 0 on : goto __Skip1
if player0x < 74 || player0x > 78 then pfpixel 15 0 on : pfpixel 16 0 on : goto __Skip1
temp1 = exit_flags[room] : if temp1{0} then goto __Unblock_Top

__Skip1
; Pac_Man_Exit_Bottom
if player0x = 76 || player0y = 152 then pfpixel 15 21 on : pfpixel 16 21 on
if player0y < 150 then pfpixel 15 21 on : pfpixel 16 21 on : goto __Skip2
if player0x < 74 || player0x > 78 then pfpixel 15 21 on : pfpixel 16 21 on : goto __Skip2
temp1 = exit_flags[room] : if temp1{1} then goto __Unblock_Bottom

__Skip2
; Pac_Man_Exit_Right
if player0y < 80 || player0y > 84 then pfvline 31 10 11 on : goto __Skip3
if player0x < 130 then pfvline 31 10 11 on : goto __Skip3
temp1 = exit_flags[room] : if temp1{2} then goto __Unblock_Right

__Skip3
; Pac_Man_Exit_Left
if player0x > 22 then pfvline 0 10 11 on : goto __Exit_Return
if player0y < 80 || player0y > 84 then pfvline 0 10 11 on : goto __Exit_Return
temp1 = exit_flags[room] : if temp1{3} then goto __Unblock_Left
goto __Exit_Return

 

;****************************************************************
;
; Exit Boundries
; Seems like the data references each room is based upon bank6

; %00000101 is room 0 with top and right exits

; %00001100 is room 1 with left and right exits

; %00001000 is room 2 with just a left exit

; %00001111 is room 18 with all four exits

data exit_flags
%00000101, %00001100, %00001000, %00001100, %00001001, %00001001, %00001101, %00001101, %00000101, %00000011, %00000011, %00000011
%00000010, %00000101, %00001011, %00001011, %00001110, %00001100, %00001111, %00000111, %00001100, %00001110, %00001100, %00001000
%00001010
end

__Unblock_Top
; top exit open (Works)
if player0x = 76 && player0y < 15 then pfpixel 15 0 off : pfpixel 16 0 off
goto __Exit_Return

__Unblock_Bottom
; bottom exit open (Works)
if player0x = 76 || player0y > 152 then pfpixel 15 21 off : pfpixel 16 21 off
goto __Exit_Return

__Unblock_Right
; right exit open (Works)
if player0y = 82 || player0x = 132 then pfvline 31 10 11 off
goto __Exit_Return

__Unblock_Left
; left exit open (Works)
if player0y = 82 || player0x <= 21 then pfvline 0 10 11 off

__Exit_Return

default.bas.bin

Pac_Man_Eat_and_Run - 14 Oct 16 (DPC+).txt

Edited by Lewis2907
Link to comment
Share on other sites


it would be something like




; you have to get temp1 in what ever bank has room_shape
temp1 = room_shape[room] : goto draw_room_shape bank6



then in bank6




draw_room_shape
on temp1 goto rs0 rs1 rs2 rs3 rs4 rs5 rs6 rs7 rs8 rs9 rs10 rs11 rs12 rs13 rs14 rs15 rs16 rs17 rs18 rs19 rs20 rs21 rs22 rs23 rs24



I used rs instead of draw_room_shape because

there's a limit to how much you can put on a line

if you just have to you can break the line up

or there are ways to put/use the addresses (labels) in data statements

which involves microscopic amounts of asm


I'd just use short labels if possible


you could have up to 256 labels in two data statements and data statements can span multiple lines


temp2 is right after temp1


the jmp( ) instuction takes the low byte of its target from the location specified (in this case temp1)

and the high byte from the following location


bB prepends a "." to labels in the asm it emits


> specifies the high byte of the (two byte) label, < specifies the low byte


so one way to use data statements would be




temp2 = labelhi[temp1] : temp1 = labello[temp1]

asm
jmp(temp1)
end


data labelhi
>.draw_room_shape_0,
>.draw_room_shape_1,
>.draw_room_shape_2,
(etc)
.
.
>.draw_room_shape_24,
end

data labello
<.draw_room_shape_0,
<.draw_room_shape_1,
<.draw_room_shape_2,
(etc)
.
.
<.draw_room_shape_24,
end


Edited by bogax
Link to comment
Share on other sites

 

it would be something like
  ; you have to get temp1 in what ever bank has room_shape
  temp1 = room_shape[room] : goto draw_room_shape bank6
then in bank6
draw_room_shape
  on temp1 goto rs0 rs1 rs2 rs3 rs4 rs5 rs6 rs7 rs8 rs9 rs10 rs11 rs12 rs13 rs14 rs15 rs16 rs17 rs18 rs19 rs20 rs21 rs22 rs23 rs24
I used rs instead of draw_room_shape because
there's a limit to how much you can put on a line
if you just have to you can break the line up
or there are ways to put/use the addresses (labels) in data statements
which involves microscopic amounts of asm
I'd just use short labels if possible
you could have up to 256 labels in two data statements and data statements can span multiple lines
temp2 is right after temp1
the jmp( ) instuction takes the low byte of its target from the location specified (in this case temp1)
and the high byte from the following location
bB prepends a "." to labels in the asm it emits
> specifies the high byte of the (two byte) label, < specifies the low byte
so one way to use data statements would be
 temp2 = labelhi[temp1] : temp1 = labello[temp1]
 
 asm
 jmp(temp1)
end
 
 
 data labelhi
 >.draw_room_shape_0, 
 >.draw_room_shape_1,
 >.draw_room_shape_2,
 (etc)
 .
 .
 >.draw_room_shape_24,
end
 
 data labello
 <.draw_room_shape_0, 
 <.draw_room_shape_1,
 <.draw_room_shape_2,
 (etc)
 .
 .
 <.draw_room_shape_24,
end

 

Bogax,

 

Thanks for the code. It worked. I did move some other stuff around to free up space. I also fixed the end game in room 12. I had several issues there. I think I got it fixed from my test of playing the game. I figured out where my scanline issue is so far. It's where I use "gosub __Ghost_Direction bank5" if I turn that off and just use pacman alone there is no issue changing rooms. I am fairly sure that is where my issue are with all the gosub's I have in bank5 for the ghost AI. I'm still working on a way to compress it and use less gosubs there.

 

; **********************************

; Red / Shawdow AI Movements

;

if Red_Ghost = 1 then gosub __Red_Ghost_Right : pfhline 15 12 16 on ; safe house

if Red_Ghost = 2 then gosub __Red_Ghost_Left : pfhline 15 12 16 off ; safe house

if Red_Ghost = 3 then gosub __Red_Ghost_Up

if Red_Ghost = 4 then gosub __Red_Ghost_Down

 

; **********************************

; Pinky / Speedy AI Movements

;

if Pink_Ghost = 1 then gosub __Pink_Ghost_Right

if Pink_Ghost = 2 then gosub __Pink_Ghost_Left : pfhline 15 12 16 off ; safe house

if Pink_Ghost = 3 then gosub __Pink_Ghost_Up

if Pink_Ghost = 4 then gosub __Pink_Ghost_Down : pfhline 15 12 16 on ; safe house

 

; **********************************

; Blue / Bashful AI Movements

;

if Blue_Ghost = 1 then gosub __Blue_Ghost_Right

if Blue_Ghost = 2 then gosub __Blue_Ghost_Left

if Blue_Ghost = 3 then gosub __Blue_Ghost_Up

if Blue_Ghost = 4 then gosub __Blue_Ghost_Down

 

; **********************************

; Orange / Pokey AI Movements

;

if Orange_Ghost = 1 then gosub __Orange_Ghost_Right

if Orange_Ghost = 2 then gosub __Orange_Ghost_Left

if Orange_Ghost = 3 then gosub __Orange_Ghost_Up

if Orange_Ghost = 4 then gosub __Orange_Ghost_Down

return otherbank

 

More code below to reflect the calls from above.

 

Thanks again for the codes that you have shared. They have helped me brainstorm on what I am planing to make next. I am going to try and make 100 rooms if possible once I get this game complete to help build up more of my Bb knowledge. Hopefully you or someone who has some time can compress Bank5 Ghost AI into a cleaner code or point me in the right direction and I can work on figuring it out, thanks.

default.bas.bin

Pac_Man_Eat_and_Run - 15 Oct 16 (DPC+).txt

Edited by Lewis2907
Link to comment
Share on other sites

RT,

 

Thanks. I used your pfread and other parts of your program to make the other 4 move around. I will look at the code maybe Monday or so to see if can compress it or something to reduce the gosubs. Hopefully the stuff I am posting will help other newbies like myself when making a game with Bb.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...