[A83] hitdetection


[Prev][Next][Index][Thread]

[A83] hitdetection



I'm working on a hitdetection-routine for a ball-game.  The balls that are
moving around the field have an equation (y(x)=ax+b) (i use left-bottom as
(0,0) and work with pixels (so x from 0 to 95 and y from 0 to 64) and every
frame I increase 'x'  1 or more times.
Now hitdetection would work this way: i check if  d(m1,m2)=rē (m1: centre of
the ball that is moving, m2: centre of ball i want to check (if hit) and r:
the radius of the ball)
Now my question is: should i work with OP1-OP6 ('cause i know they are
easily to work with (for multiplying, square root,...)) or should i work
with the usual registers: af, bc, de and hl ('cause my coordinates have to
be integers in the end)
Another problem would be that the balls aren't really circles, they're
sprites that look like circles...

Ball:
         .db     %01110000
         .db     %11111000
         .db     %11111000            :=> third number of this row would be
the centre
         .db     %11111000
         .db     %01110000
         .db     %00000000
         .db     %00000000
         .db     %00000000




Follow-Ups: