Jump to content

Photo

Pac_Man Eat n Run


38 replies to this topic

#26 bogax ONLINE  

bogax

    Dragonstomper

  • 717 posts

Posted Sat Oct 15, 2016 2:29 PM

I doubt if the gosubs are much of a problem

 

I notice you're using return otherbank in several place where it looks like you don't need that

 

since the ghosts are moving slowly try increasing the velocity but only moving one ghost per frame



#27 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Sun Oct 16, 2016 4:53 PM

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.

#28 bogax ONLINE  

bogax

    Dragonstomper

  • 717 posts

Posted Mon Oct 17, 2016 7:48 PM

 
 rand&108 will produce one of 16 possible numbers
 0, 4, 8, 12, 32, 36, 40, 44, 64, 68, 72, 76, 96, 100, 104 or 108
 
 
 this shows a histogram for the numbers 0..31
 
 R# 0 Is just rand
 R# 1 is rand & 108
 R# 2 is rand & 109
 R# 3 is rand & 110 
 

Attached Files



#29 bogax ONLINE  

bogax

    Dragonstomper

  • 717 posts

Posted Mon Oct 17, 2016 8:00 PM

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 



#30 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Mon Oct 17, 2016 8:06 PM

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.

#31 bogax ONLINE  

bogax

    Dragonstomper

  • 717 posts

Posted Mon Oct 17, 2016 8:42 PM

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  



#32 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Thu Oct 20, 2016 12:54 PM

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

Attached Files


Edited by Lewis2907, Thu Oct 20, 2016 3:55 PM.


#33 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Mon Oct 24, 2016 12:39 AM

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.
 
 

Attached Files


Edited by Lewis2907, Mon Oct 24, 2016 2:03 AM.


#34 TrekMD ONLINE  

TrekMD

    River Patroller

  • 3,324 posts
  • Location:Coral Gables, FL

Posted Mon Oct 24, 2016 11:05 AM

Cool, will be trying it out.



#35 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Sat Nov 4, 2017 5:07 PM

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.randomter...s.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

Attached Files


Edited by Lewis2907, Sun Nov 5, 2017 5:27 PM.


#36 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Sun Nov 5, 2017 9:03 PM

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/...el#entry1561837

 

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

Attached Files



#37 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,231 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sun Nov 5, 2017 9:32 PM

I usually play with the conversion numbers until they work. It helps me to temporarily draw playfield pixels while moving the sprite to see if I have things lined up. When it seems to be perfect, I use those numbers.



#38 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Sun Nov 5, 2017 10:17 PM

RT,

 

Thanks. I was doing that as well (I think) just changing the number and just moving right to start with and so forth. Thanks again for all the help and page you maintain. 



#39 Lewis2907 OFFLINE  

Lewis2907

    Chopper Commander

  • Topic Starter
  • 137 posts
  • Location:Senatobia, MS

Posted Wed Nov 8, 2017 10:19 PM

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

Attached Files


Edited by Lewis2907, Wed Nov 8, 2017 10:20 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users