I finished a part of "Hittest" and "Character design".
Hittest:
Basically, just find out the centre of a circle and the radius of eact object.
Then set up the effective area. Below is the example:
h_dist = objectA._x - objectB._x;
v_dist = objectA._y - objectB._y;
t_dist = Math.sqrt(h_dist*h_dist + v_dist*v_dist);
A_r = objectA._width/2;
B_r = objectB._width/2;
if (t_dist <= A_r + B_r) {life -= 10;}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment