Skip to main content
Inspiring
June 1, 2013
Question

Collision?

  • June 1, 2013
  • 1 reply
  • 587 views

I have a problem :S

I have a gun which shoots a bullet to the mouse.

I have enemies.

The bullet is made with - graphics.lineTo(mouseX, mouseY);

Then is recalculated with - graphics.clear();

                                              graphics.lineTo(enemy.x, enemy.y);

You get the picture...

My problem lies here. The bullet when recalculated draws to the center of the enemy instead of the collision point and Ino why that is happening it because im using enemy.x and enemy.y.

How can I detect the exact collision point of the bullet on the enemy?

because then I can just draw line like this - graphics.lineTo(CollisionPointX, CollisionPointY);

Thanks

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
June 1, 2013

What are you describing as "the collision point of the bullet"?  What determines where that is?

Inspiring
June 1, 2013

Im not sure, I need to find the exact point where the bullet collides with the enemy so then I can draw a line to that exaxt point

Inspiring
June 2, 2013

Either the exact point where the bullet collides or some kind of formulea to keep the inline with the mouse