I just finished adding collision between the ball and missile 0 and it isn't working at all. I double checked my code and it looks ok. Could someone please help me?
Sincerely,
Michael
Posted Sat May 16, 2009 10:05 AM
Posted Sat May 16, 2009 10:22 AM
Posted Sat May 16, 2009 10:51 AM
Primordial Ooze, on Sat May 16, 2009 12:05 PM, said:
SkipBallOffTopOfScreen ldy #%01000000 bit CXM0FB ; did the ball collide with missile 0? beq NoCollisionWithMissile0; skip if no collision occured ldx #256-1 ; must be a hit! reverse the ball's y velocity NoCollisionWithMissile0(1) It looks like you're trying to use "bit" to compare CXM0FB to the value you put into the "Y" register, but "bit" compares with the accumulator. Anyway, you don't need to compare CXM0FB to anything, because "bit" copies bits 6 and 7 into the overflow and sign bits automatically. So you can take out "ldy #%01000000" entirely, and change the "beq" to "bvc."
SkipBallOffTopOfScreen bit CXM0FB ; did the ball collide with missile 0? bvc NoCollisionWithMissile0; skip if no collision occured ldx #1 ; must be a hit! reverse the ball's y velocity NoCollisionWithMissile0 sta CXCLR ; clear the collision registersMichael
Posted Sat May 16, 2009 10:55 AM
Robert M, on Sat May 16, 2009 11:22 AM, said:
Posted Sat May 16, 2009 11:12 AM
Primordial Ooze, on Sat May 16, 2009 12:55 PM, said:
SkipBallOffTopOfScreen bit CXM0FB ; did the ball collide with missile 0? bvs NoCollisionWithMissile0; skip if no collision occured ldx #256-1 ; must be a hit! reverse the ball's y velocity NoCollisionWithMissile0After:
SkipBallOffTopOfScreen bit CXM0FB ; did the ball collide with missile 0? bvc NoCollisionWithMissile0; skip if no collision occured ldx #1 ; must be a hit! reverse the ball's y velocity NoCollisionWithMissile0Then things will work as expected.
0 members, 1 guests, 0 anonymous users