Having no pfpixel makes it almost impossible for me to figure anything out with that kernel. It's way over my head.

Started by Lewis2907, Sep 22 2016 4:53 PM

63 replies to this topic

Posted Wed Dec 20, 2017 3:44 PM

Having no pfpixel makes it almost impossible for me to figure anything out with that kernel. It's way over my head.

Posted Wed Dec 20, 2017 3:58 PM

RT,

I agree, but it's interesting to play with Bogax code. Making me think (for what I know in Bb) and just try stuff here and there. I was hoping to get this to work so you can make a Multisprite Maze for the page that you maintain. That would make a complete collection of your "Mazes" and then allow me to convert the DPC+ Pac_Man_Eat n Run.

http://atariage.com/...ttach_id=473911

Since it won't play on the AFB I decided to stay with Standard and Multisprite. If they fix the AFB to work with DPC+ that would be great. Thanks again for trying to help. I will continue to play with the code and see what I can do with the plug and play method.

- Random Terrain likes this

Posted Thu Dec 21, 2017 1:49 PM

I'm not sure if anyone can explain it better or if I am wrong. I'm guessing here.

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

; Below I think is where you make changes to adjust the pixel decection

; I assume dim __Temp1 = e : dim __Temp2 = f (replace temp1 / temp2)

;

; Then make adjustments by guessing and plug this into the down and right

; movement of the code. Should work I guess.

;

temp1 = player0x

temp2 = player0y

temp1 = (player0x - 16)/4

temp2 = (player0y-3)/2

temp1 = msk_pf_rd(temp1, temp2)

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

;

; Controls the pfread portion of the playfield.

; maybe adjust pfheight=1

; correlation maybe difficult (if someone wanted a different pfhieght)

;

temp1 = temp1 & 7

temp1 = bits[temp1] & temp2

if temp1 then temp1 = 255

return

data bits

$80,$40,$20,$10,8,4,2,1

end

Posted Sun Dec 24, 2017 9:05 PM

Here is another update. I am stuck with Bogax's code, but I am using code from Gemintronic "SLost001.zip". It looks more promising.

The collsigion is working (almost there). Mainly in Batari Basic form vice ASM. Also will bank switch.

Is it possible to get the below use fixed point math? I have tried the formulas I am use to and no luck. If the below could have .1 instead of 1. Then the sprite would glide more precisely along the walls.

if joy0left then global_temp1 = global_temp1 - 1

if joy0left && !pfread(global_temp1, global_temp2) then player_x = player_xprevious + 1

if joy0left then player_x = player_x - 1

if player0x < 20 then player_x = player_x + 1

I think I'm a lot closer to getting this to work. Any help or ideas would be appreciated, thanks.

***Edited***

Cleaned up the code and put remarks in the program. Still one pixel off for a clean 8*8 sprite. Could shrink the sprite some to make it "look" cleaner.

I also attached the Standard Kernel Collision Detection as well. The two are similar, but I am missing something on how to make it work for the Multisprite. I think I know why and will try that option next.

**Edited by Lewis2907, Mon Dec 25, 2017 12:40 AM.**

Posted Tue Dec 26, 2017 1:12 PM

Managed to get the sprite to look very smooth for movements. The issue still one pixel for a reference point, but I can live with this. Hopefully someone can make it a true 8*8 sprite. I have an idea to maybe flip the reference point of the pixel to allow for better detection, but that is still a WIP. Fixed point math works now for player speed control. Will bank switch 32k or 32kSC.

Maybe RT can now work his magic and make a "multisprite maze". I plan to try and insert his code to see what I can do and then continue to work on Pac_Man Eat n Run (Multisprite) and Standard Kernel Versions to play on the AFP. I have stopped with the DPC Verison as I am wanting to make games for the AFP.

Posted Tue Dec 26, 2017 3:05 PM

Since a little time has gone by and my frustration with it has faded, I'll look at that maze program that I was trying to convert to multisprite and see if I can get it working.

Posted Tue Dec 26, 2017 8:23 PM

Since a little time has gone by and my frustration with it has faded, I'll look at that maze program that I was trying to convert to multisprite and see if I can get it working.

RT, thanks. I know this is probably a daunting task. From what I have learned so far this code can be adapted to make other multisprite games. The "Maze" examples are difficult in themselves. It seems I make some progress then I get stuck. This is what I have tried so to "trick" the one pixel by moving and or triggering it to "simulate" the 8*8 sprite.

of note player0x = 81, 82, 83, 71, 70, 69 seems not to work unless the playfield is drawn completely to keep player0 from crossing the playfield. I assume it's because of the mirrored playfield.

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

;

; Don't move up if pfpixel is in the way. (Works somewhat, 1 pixel off)

; Don't move up off screen. Boundry set.

; Player speed control .5 + .5 must equal a whole number to work

;

; if joy0up && !_Bit6_Flip_P0{6} controls sprite facing right and up

; if joy0up && _Bit6_Flip_P0{6} controls sprite facing left and up

;

if joy0up && !_Bit6_Flip_P0{6} then global_temp2=((player0y-4)/2)+1 : global_temp1=(player0x - 16)/4

if joy0up && !_Bit6_Flip_P0{6} && !pfread(global_temp1, global_temp2) then _P0_U_D= _P0_U_D - .5

if joy0up && _Bit6_Flip_P0{6} then global_temp2=((player0y-4)/2)+1 : global_temp1=(((player0x - 5)/4)-1)

if joy0up && _Bit6_Flip_P0{6} && !pfread(global_temp1, global_temp2) then _P0_U_D= _P0_U_D - .5

if joy0up then _P0_U_D = _P0_U_D + .5

if player0y > 84 then _P0_U_D = _P0_U_D - 1

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

;

; Don't move down if pfpixel is in the way. (Works for 8*8 sprite)

; Don't move up off screen. Boundry set.

; Player speed control .5 + .5 must equal a whole number to work

;

; if joy0up && !_Bit6_Flip_P0{6} controls sprite facing right and down

; if joy0up && _Bit6_Flip_P0{6} controls sprite facing left and down

;

if joy0down && !_Bit6_Flip_P0{6} then global_temp2=global_temp2-4 : global_temp1=(player0x - 16)/4

if joy0down && !_Bit6_Flip_P0{6} && !pfread(global_temp1, global_temp2) then _P0_U_D= _P0_U_D + .5

if joy0down && _Bit6_Flip_P0{6} then global_temp2=global_temp2-4 : global_temp1=(((player0x - 5)/4)-1)

if joy0down && _Bit6_Flip_P0{6} && !pfread(global_temp1, global_temp2) then _P0_U_D= _P0_U_D + .5

if joy0down then _P0_U_D = _P0_U_D - .5

if player0y < 4 then _P0_U_D = _P0_U_D + 1

**Edited by Lewis2907, Tue Dec 26, 2017 8:26 PM.**

- Random Terrain likes this

Posted Thu Jun 7, 2018 7:18 PM

Attached is the Multisprite Version I am working on. Since there is no pfpixel or exact pfread that I know of I did the calculation based up "X" and "Y" points. So far it's working. My issue so far is that when moving up and down the edges and you push right you stop and move right. I have been trying to find a way to make player0 move and up and down and by pass the "right" or "left" getting stuck. It will work later on as I have plans to move to next screen as in the DPC Version (I will work that once AFP can support it). I also have a few more ideas for the game as well that should make it more interested than the DPC Version.

I think my issue is below and through out the code. Once I complete this I am going to move on to making player1-4 move about the maze. This will be interesting as I am running low on variables, but I have an idea to use Constants since Batari Basic had a limit of 50 constants, but that limit was later increased to 500. As always thanks to everyone for helping me improve my programming of Bb, thanks.

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

;

; Allows player0 to move down to a level 6

;

if player0x = 19 && player0y <= 30 then gosub __Down

if player0x = 40 && player0y <=30 then gosub __Down

if player0x = 57 && player0y <= 30 then gosub __Down

if player0x = 95 && player0y <= 30 then gosub __Down

if player0x = 112 && player0y <=30 then gosub __Down

if player0x = 133 && player0y <= 30 then gosub __Down

if player0y = 18 then _Bit0_P0_Floor = 6 : return

if player0y < 30 then return

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

;

; Sets player0 right side limits based off of playfiield

;

if player0x > 18 && player0x < 70 then gosub __Left_Right

if player0x = 18 then gosub __Right

if player0x = 70 then gosub __Left

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

;

; Sets player0 left side limits based off of playfiield

;

if player0x > 82 && player0x < 134 then gosub __Left_Right

if player0x = 82 then gosub __Right

if player0x = 134 then gosub __Left

return

- TrekMD likes this

Posted Fri Jun 8, 2018 2:19 PM

Another update. I fixed it where it won't get stuck on the outer walls. Next update will have the ability to move through the exits either to another Level or just a Warp. That was one idea I plan incorporate into this Version. Along with the Ghost Moving about. That will be a challenge in itself to accomplish.

Posted Mon Jun 11, 2018 9:03 PM

I would post the code like I normally do, but it very messy with notes and different versions based on different ways i'm trying to go. If I can get some ideas / help below I can try to work it in.

Is there a way to make this work or easier way? Basically if I can pin point the exact coordinates like below and have a "Random Number" based off of "Select" then player2 has no choice but to follow the maze until the next opening and pick randomly. The issue I see thus far is that the pattern might be very predictable.

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

;

; Blue Ghost / Player2 moves right at start of level

;

__Blue_Ghost_Move

if Blue_Ghost = 0 then _P2_L_R = _P2_L_R + .5

if player2x = 77 && player2y = 64 then Blue_Ghost = (rand&3)+1 : gosub __All_Blue_Moves ; Select 2

if player2x = 28 && player2y = 78 then Blue_Ghost = (rand&3)+1 : gosub __All_Blue_Moves ; Select 1, 4

if player2x = 28 && player2y = 64 then Blue_Ghost = (rand&3)+1 : gosub __All_Blue_Moves ; Select 1, 3, 4

if player2x = 28 && player2y = 16 then Blue_Ghost = (rand&3)+1 : gosub __All_Blue_Moves ; Select 1, 3

if player2x = 141 && player2y = 16 then Blue_Ghost = (rand&3)+1 : gosub __All_Blue_Moves ; Select 3, 2

if player2x = 141 && player2y = 78 then Blue_Ghost = (rand&3)+1 : gosub __All_Blue_Moves ; Select 2, 4

return

__All_Blue_Moves

if Blue_Ghost = 1 then _P2_L_R = _P2_L_R + .5 ; go right

if Blue_Ghost = 2 then _P2_U_D = _P2_U_D - .5 ; go left

if Blue_Ghost = 3 then _P2_U_D = _P2_U_D + .5 ; go up

if Blue_Ghost = 4 then _P2_U_D = _P2_U_D - .5 ; do down

return

My other question is there a way to reduce my "bloated code" it works, but takes up a lot of space. Currently this only leave 907 in bank 2. I used return otherbank to gain 10 bytes per use. At this rate I would be able to make maybe 5-6 levels which is no where like the DPC version with 25 levels.

__3F_L1

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

;

; Allows player0 to move up to a level 2

;

if player0x = 19 && player0y >=54 then gosub __Up bank6

if player0x = 40 && player0y >=54 then gosub __Up bank6

if player0x = 112 && player0y >=54 then gosub __Up bank6

if player0x = 133 && player0y >=54 then gosub __Up bank6

if player0y = 66 then _Bit0_P0_Floor = 2 : return otherbank

if player0y > 54 then return otherbank

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

;

; Allows player0 to move down to a level 4

;

if player0x = 19 && player0y <= 54 then gosub __Down bank6

if player0x = 52 && player0y <= 54 then gosub __Down bank6

if player0x = 100 && player0y <= 54 then gosub __Down bank6

if player0x = 133 && player0y <= 54 then gosub __Down bank6

if player0y = 42 then _Bit0_P0_Floor = 4 : return otherbank

if player0y < 54 then return otherbank

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

;

; Sets player0 left and rights limits based off of playfiield

;

if player0x > 30 && player0x < 122 then gosub __Left_Right bank6

if player0x = 30 then gosub __Right bank6

if player0x = 122 then gosub __Left bank6

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

;

; Sets player0 left and rights warp location "Middle of Screen"

;

if player0x = 133 && joy0right then _Bit6_Flip_P0{6} = 0 : _BitO_P0_Direction = 5 : gosub __Right_Warp bank6

if _BitO_P0_Direction = 5 then gosub __Right_Warp bank6

if player0x = 19 && joy0left then _Bit6_Flip_P0{6} = 1 : _BitO_P0_Direction = 6 : gosub __Left_Warp bank6

if _BitO_P0_Direction = 6 then gosub __Left_Warp bank6

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

;

; Sets player0 left and rights correct direction after warp

; location "Middle of Screen"

;

if c{3} && player0x = 133 then gosub __Static_Player bank6

if c{4} && player0x = 19 then gosub __Static_Player bank6

return otherbank

Posted Tue Jun 12, 2018 7:54 PM

Get rid of the redundancy

166 bytes

if player0x = 19 && player0y >=54 then gosub __Up bank6 if player0x = 40 && player0y >=54 then gosub __Up bank6 if player0x = 112 && player0y >=54 then gosub __Up bank6 if player0x = 133 && player0y >=54 then gosub __Up bank6 if player0y = 66 then _Bit0_P0_Floor = 2 : return otherbank if player0y > 54 then return otherbank

148 bytes

if player0y < 54 then skip if player0x = 19 then gosub __Up bank6 if player0x = 40 then gosub __Up bank6 if player0x = 112 then gosub __Up bank6 if player0x = 133 then gosub __Up bank6 if player0y = 66 then _Bit0_P0_Floor = 2 : return otherbank if player0y > 54 then return otherbank skip

82 bytes

if player0y < 54 then skip if player0x = 19 then gosub gsUp if player0x = 40 then gosub gsUp if player0x = 112 then gosub gsUp if player0x = 133 then gosub gsUp if player0y = 66 then _Bit0_P0_Floor = 2 : return otherbank if player0y > 54 then return otherbank skip gsUp goto __Up bank6

77 bytes

if player0y < 54 then skip temp1 = 4 loop if player0x = p0xUpdat[temp1] then gosub __Up bank6 : goto skip temp1 = temp1 - 1 ; if temp1 then loop if player0y = 66 then _Bit0_P0_Floor = 2 : return otherbank if player0y > 54 then return otherbank skip const p0xUpdat = dat1 - 1 data dat1 19, 40, 112, 133 end

Posted Fri Jun 15, 2018 9:29 AM

Oops

I goofed the loop

It will miss the player0y > 54 test

So I guess it should be something like this

if player0y < 54 then skip temp1 = 4 loop if player0x = p0xUpdat[temp1] then gosub __Up bank6 : goto p0yGt54test temp1 = temp1 - 1 ; if temp1 then loop if player0y = 66 then _Bit0_P0_Floor = 2 : return otherbank p0yGt54test if player0y > 54 then return otherbank skip const p0xUpdat = dat1 - 1 data dat1 19, 40, 112, 133 end

Posted Fri Jun 15, 2018 11:01 PM

Bogax,

Thanks. I will use this Monday.

Thanks. I will use this Monday.

Posted Mon Jun 18, 2018 4:57 PM

I was able to use Bogax Code to save several bytes. Is there a way to save bytes in the code below and revamp the AI Code to work properly. I think it can be done in a table like what Bogax did, but the random numbers / pick a correct path may be a challenge.

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

;

; Sets player0 right side limits based off of playfiield

;

if player0x > 18 && player0x < 70 then gosub __Left_Right bank6

if player0x = 18 then gosub __Right bank6

if player0x = 70 then gosub __Left bank6

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

;

; Sets player0 left side limits based off of playfiield

;

if player0x > 82 && player0x < 134 then gosub __Left_Right bank6

if player0x = 82 then gosub __Right bank6

if player0x = 134 then gosub __Left bank6

return otherbank

__Ghost_Direction

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

;

; Select the correct floor based on player1y positions

; y position is in crements of

; player1y = 76 (1st floor)

; player1y = 64 (2nd floor)

; player1y = 54 (3rd floor)

; player1y = ** (4th floor)

; player1y = ** (5th floor)

; player1y = 16 (6th floor)

; left and right limits for "X" are 28 / 141

;

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

;

; Allows player1 to move based off of Level 1

; (1 = Up) (2 = Down) (3 = Left) (4 = Right)

;

if Red_Ghost = 0 then _P1_L_R = _P1_L_R - .5

if player1x = 77 && player1y = 64 then gosub __Ghost_L

if player1x = 28 && player1y = 78 then Red_Ghost = (rand&3)+1 : gosub __Ghost_D_R ; Select 2, 4

if player1x = 28 && player1y = 64 then Red_Ghost = (rand&3)+1 : gosub __Ghost_U_D_R ; Select 1, 2, 4

if player1x = 28 && player1y = 16 then Red_Ghost = (rand&3)+1 : gosub __Ghost_U_R ; Select 1, 4

if player1x = 141 && player1y = 16 then Red_Ghost = (rand&3)+1 : gosub __Ghost_U_L ; Select 1, 3

if player1x = 141 && player1y = 78 then Red_Ghost = (rand&3)+1 : gosub __Ghost_D_L ; Select 2, 3

if player1y < 78 && player1y > 16 then gosub __All_U_D

if player1x > 28 && player0x < 141 then gosub __All_L_R

return

0 members, 0 guests, 0 anonymous users