Animan, on Fri Jun 10, 2011 5:56 PM, said:
Right now, I have some very basic physics. It only detects if you hit the bumpers on the top or bottom of them, and sometimes the ball will go right through the bumper. It's harder to program than it looks.
Did you use the code exactly as it is here, or did you change it around:
http://www.atariage....-and-collision/
rem ****************************************************************
rem ****************************************************************
rem *
rem * Ball/Playfield collision Check.
rem *
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' If there is no collision, skip this section.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
if !collision(playfield,ball) then goto Skip_Ball_Collision
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Makes sure the ball is within the playfield area.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
if ballx > 18 && ballx < 143 && bally > 3 && bally < 87 then goto Skip_to_PF_Pixel_Set_Up
goto Skip_Ball_Collision
Skip_to_PF_Pixel_Set_Up
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Converts bally coordinates to playfield coordinates.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
MyTemp02 = (bally-1)/8
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Ballx coordinate conversion depends on ballx direction.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
if !BitOp5_B_Direction_X{5} then MyTemp01 = (ballx-17)/4 : goto Check_Up_Down
MyTemp01 = (ballx-18)/4
Check_Up_Down
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Up/Down Check:
rem '
rem ' Check for playfield pixels above and below the ball.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
temp5 = MyTemp02+1 : temp6 = MyTemp02-1
if pfread(MyTemp01,temp5) then goto Bounce_Up_Down
if pfread(MyTemp01,temp6) then goto Bounce_Up_Down
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Diagonal Check:
rem '
rem ' Check for playfield pixels diagonally around the ball
rem ' (right-down, left-down, right-up, and left-up).
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
temp3 = MyTemp01+1 : temp4 = MyTemp01-1
if pfread(temp3,temp5) then goto Bounce_Left_Right
if pfread(temp4,temp5) then goto Bounce_Left_Right
if pfread(temp3,temp6) then goto Bounce_Left_Right
if pfread(temp4,temp6) then goto Bounce_Left_Right
goto Check_Left_Right
Bounce_Up_Down
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Reverse bally direction.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
BitOp6_B_Direction_Y = BitOp6_B_Direction_Y ^ %01000000
Check_Left_Right
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Righ/Left Check:
rem '
rem ' Check for playfield pixels to the right and left of the ball.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
temp5 = MyTemp01+1 : temp6 = MyTemp01-1
if pfread(temp5,MyTemp02) then goto Bounce_Left_Right
if pfread(temp6,MyTemp02) then goto Bounce_Left_Right
goto Skip_Ball_Collision
Bounce_Left_Right
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
rem ' Reverse ballx direction.
rem '
rem ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem '
BitOp5_B_Direction_X = BitOp5_B_Direction_X ^ %00100000
Skip_Ball_Collision
I tried moving the order of the code around, but it would only work right the way I have it above. Every other configuration I tried screwed up. That's why it took me about a week to get it working right.