Jump to content
IGNORED

Pac_Man Eat n Run


Lewis2907

Recommended Posts

Bogax,

 

Thanks for the tips. I read that return otherbank and thisbank are faster than just return. I will look through the code to remove them where not needed.

 

For moving one ghost at a time. Is there any material to read up on that? I plan to look at the code some more tomorrow, thanks.

Link to comment
Share on other sites

Bogax,

 

Thanks for the tips. I read that return otherbank and thisbank are faster than just return. I will look through the code to remove them where not needed.

 

For moving one ghost at a time. Is there any material to read up on that? I plan to look at the code some more tomorrow, thanks.

 

you use return otherbank for the first four ghost routines in bank 5 but I think you only call them from bank 5

 

 

if you have a spare bit somewhere use it as a one bit frame counter

do two ghosts when it's 0 and the other two when it's 1

Link to comment
Share on other sites

Bogax,

 

If I'm tracking what you are saying. That the rand is wasting cycles and I should just go with a constant number to make the program run faster. I noticed if I turned off the fruit part the changing of rooms works better. If I turn off the ghosts of course it works a lot better.

Link to comment
Share on other sites

Bogax,

 

If I'm tracking what you are saying. That the rand is wasting cycles and I should just go with a constant number to make the program run faster. I noticed if I turned off the fruit part the changing of rooms works better. If I turn off the ghosts of course it works a lot better.

 

more pointing out that they're not very evenly distributed

but I don't know what you want

Link to comment
Share on other sites

Bb Team,

 

Does anyone know a trick to shut off a gosub routine. Meaning When I go do " temp1 = room_shape[room] : goto draw_room_shape bank6" I want to shut off the "gosub __Ghost_Direction bank5" then after the room is drawn turn the "gosub __Ghost_Direction bank5" bank on. What I found is if I turn the ghost off and move around the rooms the scalines are correct. If I turn them on then scalines jump. If I can get past this part I should be about complete with the game. The finishing touches should be fairly easy to complete after that . I can then use what I have learned from here to make the next homage game with 100 levels or rooms that I have in mind. Thanks again to everyone who has helped me with this game.

 

Also I did try to use a bit and a variable to turn on/off the gosub. I couldn't get it to work.

 

__Main_Loop

; **********************************
; Pac_Man and Ghost Controls
;
gosub __Ghost_Direction bank5
gosub __Pac_Man_Controls bank3


;****************************************************************
;
; Detrermines which maze to draw next
;
if player0y = 6 then gosub go_north
if player0x = 136 then gosub go_east
if player0y = 160 then gosub go_south
if player0x = 19 then gosub go_west
goto __Skip_Rooms

go_north
player0y = 154
room = move_north[room]
goto draw_room

go_east
player0x = 20
room = move_east[room]
goto draw_room

go_south
player0y = 6
room = move_south[room]
goto draw_room

go_west
player0x = 133
room = move_west[room]

draw_room
; *************************************
; Location of fruits and palyfield detection
;
__Fruit_Location

; Apple
player5:
%0000010
%0000100
%0001100
%0001100
%0110110
%1111111
%1011111
%1011111
%1011111
%0101110
%0010100
%1111111
%1111111
end
player5color:
$00
$00
$00
$B2
$40
$40
$40
$40
$40
$40
$40
$00
$00
end

; Pear
player6:
%00000001
%00000001
%00000001
%00000001
%00000010
%00011100
%01111100
%11111000
%11111000
%11111000
%01110000
%00000001
%00000001
end
player6color:
$00
$00
$00
$F0
$F0
$D2
$D2
$D2
$D2
$D2
$D2
$00
$00
end

; Mushroom
player7:
%00000001
%00000001
%00000001
%00111100
%01101110
%01111101
%11011111
%01110011
%00001100
%00011100
%00011100
%00000001
%00000001
end
player7color:
$00
$00
$00
$40
$42
$44
$46
$48
$08
$0A
$0C
$00
$00
end
; used for room 12 to end game
; Jack_o_lantern
player8:
%00001100
%01111110
%10111011
%10010011
%11111111
%10101011
%01010110
%00111100
end
player8color:
$B2
$22
$24
$26
$28
$26
$24
$22
end

P2_X = (player5x-8)/4 : P2_Y = (player5y)/8
P3_X = (player6x-8)/4 : P3_Y = (player6y)/8
P4_X = (player7x-8)/4 : P4_Y = (player7y)/8

if Red_Ghost = 1 then player5y = 57 : player6y = 153 : player7y = 105 : goto __Skip_Fruit
if Red_Ghost = 2 then player5y = 153 : player6y = 105 : player7y = 57 : goto __Skip_Fruit
if Red_Ghost = 3 || 4 then player5y = 105 : player6y = 57 : player7y = 153 : goto __Skip_Fruit

__Skip_Fruit
player6x = 23 : player7x = 56 : player5x = 83
if pfread(P2_X,P2_Y) then goto __Fruit_Location
if pfread(P3_X,P3_Y) then goto __Fruit_Location
if pfread(P4_X,P4_Y) then goto __Fruit_Location

; ***************************************************************
;
; on..goto code provided by Bogax
; you have to get temp1 in what ever bank has room_shape
;
temp1 = room_shape[room] : goto draw_room_shape bank6

__Skip_Rooms

Pac_Man_Eat_and_Run - 20 Oct 16 (DPC+).txt

default.bas.bin

Edited by Lewis2907
Link to comment
Share on other sites

I think this is complete (well for what I am able to do). Please let me know if you find any errors like the scalines etc. I will try to fix them. I took Wallaby's idea and started to sprinkle drawscreen here and there. It fixed the problem from what I can see. As always I welcome feedback, tips and tricks etc to further my knowledge of Bb, thanks.

 

;```````````````````````````````````````````````````````````````

;

; Instructions:

;

; Use the Joystick to move PacMan

; Use Selcet Switch to Pause Game

; Use BW / Color Switch to bring up and close Map

; Use switchleftb to set difficulty at titlescreen. "A" will have one life. "B" will have 3 lives

; There are a total of 25 rooms to move around

; You will start in one of 3 rooms in the lower left of the map

; Future fixes: Better Mazes. More fruit to eat with sound when eating the fruit.

; Add a secret level if possible. This is based upon space in the banks.

; Better Start, Game Over and End Game Screens

; implement suggestion from the feedback and reviews.

 

Pac_Man_Eat_and_Run - 23 Oct 16 (DPC+)v1.txt

default.bas.bin

Edited by Lewis2907
  • Like 3
Link to comment
Share on other sites

  • 1 year later...

Well I have started to port the Pac_Man Ean n Run DPC version over to AFP Multisprite (Basically to play on the AFP). While in the initial stages. I ran into a problem. Should be simple, but maybe I am over thinking it or something or my eyes are tired. I know the sprite is currently upside down because I did a cut and past from DPC. My issue so far is that I can not get the sprite to move. I did some testing and notice if I put the gosub __Pac_Man_Controls bank3 in between "draw_room and temp1 = room_shape[room] : goto draw_room_shape bank6. The sprite will change directions but not move.

 

draw_room

; ***************************************************************
;
; on..goto code provided by Bogax
; you have to get temp1 in what ever bank has room_shape
;
temp1 = room_shape[room] : goto draw_room_shape bank6

 

Hopefully someone can assist me in the minor glitch I have, thanks.

 

****Edited****

 

Disregard help for now. Basically I have to teach myself the Multisprite Kernel. Lessened learned so far from RT "http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#pfread".It will be a while, but I am making progress, thanks.

 

;***************************************************************
; If you are using the multisprite kernel, you can use a special pfread module,
; called pfread_msk.asm, made just for this kernel. It is not enabled by default.
; To enable it, you can use the include or inline command in a 2K or 4K game.
; For a bankswitched game, only the inline command will work, and the command must be placed in the last bank.
;
inline pfread_msk.asm

AFP_PacMan_Eat_N_Run.bas.bin

20171104v1 - AFP PacMan Eat and Run.txt

Edited by Lewis2907
Link to comment
Share on other sites

Bb Team,

 

Okay I made some progress. The cut and paste method to a certain degree didn't work from DPC to Multisprite. I hit the same road block again with the pfread conversion. Hopefully someone has pfread for dummies. Hopefully someone can assist me me with the conversion of RT's code that I am using. (Currently won't play on the AFP only in Stella)

 

;```````````````````````````````````````````````````````````````
; Converts player0 sprite coordinates and checks to see if
; any playfield pixels are in the way.
;
temp3 = (player0x-16)/4

temp6 = (player0y-3)/8

 

From what I understand of the code. Basically it aligns the sprite with the playfield exactly. I will continue to play with the number and try to make sense of what SeaGtGruff posted at the below link:

 

http://atariage.com/forums/topic/129542-collision-at-a-specific-point-solved-for-real-this-time/?hl=%2Bpfread+%2Bmultisprite+%2Bkernel&do=findComment&comment=1561837

 

Thanks again if anyone can assist. Also some links to help me learn on my own would be helpful.

AFP_PacMan_Eat_N_Run.bas.bin

20171105 - AFP PacMan Eat and Run.txt

Link to comment
Share on other sites

Bb Team,

 

When moving left player0 will stop at the most left wall and that's about it. Otherwise runs over everything else on the playfield. I am currently testing going left. I think there is a correlation between the below codes and some math. I think I am missing the mark on where to make adjustments. Any insights or pointing in the right direction would be great. Thanks again to anyone who can help.

 

;```````````````````````````````````````````````````````````````

; set screenheight and pixels
pfheight=3
const screenheight = 80

 

;```````````````````````````````````````````````````````````````
; Converts player0 sprite coordinates and checks to see if
; any playfield pixels are in the way.
;
temp5 = (player0x-17)/4

temp6 = (player0y)/8

 

rs0

playfield:
................
XXXXXXXXXXXXXXXX
X...............
X...............
X..XXX..XX......
X..X............
X..X............
X..XXX..........
................
................
X..XXX..........
X..X............
X..X............
X..XXX..XX..XXX.
X........X......
X........X......
X..XXX..XX..XXX.
X..X............
X..X............
XXXXXXXXXXXXXXXX
end

 

__Frame_LR_00

player0:
%01111100
%11111110
%11110000
%11110000
%11111110
%11011110
%01111100
end

20171108 - AFP PacMan Eat and Run.txt

AFP_PacMan_Eat_N_Run.bas.bin

Edited by Lewis2907
Link to comment
Share on other sites

  • 1 month later...

Not sure if anyone can help me with this. I found a collision code that I do like and dosen't use a lot space up. I found it http://atariage.com/forums/topic/179314-help-with-pfread/?hl=%2Bmultisprite+%2Bkernel+%2Bpfread&do=findComment&comment=2242899(Credit to RT and Master_Programmer) for the code. I am able to do some things with the code in the Standard Kernel, but I can't get it to work correctly in the Multisprite Kernel. Any help as always would be greatly appreciated, thanks.

20171213 - Standard Kernel.txt

20171213_Collision_Detection.bas.bin

20171213 - Multisprite.txt

AFP_PacMan_Eat_N_Run.bas.bin

  • Like 1
Link to comment
Share on other sites

RT,

 

I'm not exactly sure what you mean by "y-values are reversed". I read that portion on andomterrain.com, but I still don't get it. Do you mean try reversing: !pfread(temp6,p0_y) to !pfread(p0_y,temp6)? Is there an example code somewhere in the forum to look at? Thanks.

Link to comment
Share on other sites

RT,

 

Thanks. I did continue to play with the code. I have boundaries, but I think it was a step closer to understanding pfread and the math involved for collision. Thanks again for the support and code. I think once I have this portion complete I can move on to porting this game over to FBP.

AFP_PacMan_Eat_N_Run.bas.bin

20171215 - Multisprite.txt

Link to comment
Share on other sites

Since pfpixel doesn't work with the Multisprite Kernel, I'm having a hard time figuring out which numbers to use. Have you thought about using DPC+? At least the numbers work:

randomterrain.com/atari-2600-memories-batari-basic-commands.html#maze_dpc

Link to comment
Share on other sites

RT,

 

Roger. I have a DPC+ "PacMan_N_Run" based off your game. I was trying to get some better collision for multusprite instead of the normal:

 

if collision (player0, playfield) then ....

 

Bogax, has a very good code at :http://atariage.com/forums/topic/213290-pfread-not-working/?hl=%2Bmsk_pf_rd+%2Bdemo#entry2772553

 

msk_pf_rd_demo.bas, but his code is in asm (still trying to learn that). I thought about using his code and making changes, but the asm would be a challenge for me for player0 let alnoe 2-5. Thanks again for trying to get this to work. I will play with the code and look around the forum and see if I can find something to assit me, thanks.

  • Like 1
Link to comment
Share on other sites

I decided to go with Bogax's code from:

 

Bogax, has a very good code at :http://atariage.com/forums/topic/213290-pfread-not-working/?hl=%2Bmsk_pf_rd+%2Bdemo&do=findComment&comment=2772553

 

I made some modifications based upon what I know / think is going on with the program. The program is set up to detect a pixel (I think). The collision is smooth to a point. Up and Left works based off of 1 pixel, hence the way I shaped the block to see where it collides with the wall.

 

Next / improvements:

 

Figure out how to bankswitch up to 32k or 32kSC to have more space

 

Have the Down and Right more detectable (Or the entire block for the standard 8*8 sprite)

 

Figure out "temp2 = ((SWCHA ^ $FF) & sf)/16 : sf = SWCHA" to make it move more freely vice 1 pixel at a time and/or at different speeds.

 

Thanks in advance if anyone can assit. I plan to work on this some more and see if I can get closer to the goal.

 

MultiSprite_pfread.bas.bin

201717 -Multisprite Collision Detection.txt

Link to comment
Share on other sites

I made some progress with the Multisprite Collision Detection (using pfread for smooth collisions).

 

***Updated***

 

There is a playfield to help with 8*8 detection and boundaries so the sprite will not go off screen. If it does the sprite does weird things.

 

I added some more remarks to help explain what I am doing to the code to make it work.

 

Ability to move freely and not 1 pixel at a time.

 

***Next / improvements***

 

Figure out how to bankswitch up to 32k or 32kSC to have more space.

 

Have the Down and Right more detectable (Or the entire block for the standard 8*8 sprite).

 

Figure out ho to adjust the player speeds. I have an idea (I think) to see if will work.

 

I will work on it some more. Hopefully I am not going down the rabbit hole again.

MultiSprite_pfread.bas.bin

201719 -Multisprite Collision Detection.txt

Edited by Lewis2907
  • Like 3
Link to comment
Share on other sites

Batari Basic Team,

 

***Updated***

 

Figured out ho to adjust the player speeds. I have remarks in the program to explain what I did.

 

;***************************************************************
;
; Don't move Left if pfpixel is in the way. (Works somewhat, 1 pixel)
; Don't move left off screen. Boundry set.
;
; To adjust the speed of the sprite .8 and .2 must = 1
; The 1 is related to the "data dtbl" 0, 1, 1, 0"
; Since you can't use fixed point math in the "data dbtl"
; this is the only work around "I know of"
;
if joy0left then _P0_L_R = _P0_L_R +.2
if joy0left && temp1 then _P0_L_R = _P0_L_R +.8
if player0x < 24 then player0x = player0x + 1

 

drawscreen
goto __Main_Loop

 

data dtbl
0, 1, -1, 0,
end

 

***Next / improvements***

 

Figure out how to bankswitch up to 32k or 32kSC to have more space. (Not sure of a way ahead on this.)

 

Have the Down and Right more detectable (Or the entire block for the standard 8*8 sprite). I think maybe reversing some of the code here and there. Basically just play with it. Not sure of a way ahead on this.

 

Add player 2-5. (probably the last item on the list to work)

 

Hopefully someone can assist with these.

MultiSprite_pfread.bas.bin

201720 -Multisprite Collision Detection.txt

  • Like 1
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...