Making a bullet collide with an enemy in DirectX
<p>I'm trying to work on a project for school but I'm really struggling to make my bullets hit the enemy object perfectly. So far they kinda occasionally collide in a random location on the enemy but that only works some of the time which is frustrating!</p>

<p>This is what I have so far:</p>

<pre><code>     for (int i = 0; i &lt; 200; i++){ // 200 is number of bullets I use
            for (int k = 0; k &lt; game.enemiesVec.size(); k++){
            if ((((bullets[i].pos.x + 0.15f) &gt;(game.enemiesVec[k].x))) &amp;&amp; ((bullets[k].pos.x - 0.15f) &lt; (game.enemiesVec[k].x)) &amp;&amp;
                (((bullets[i].pos.y) &lt; (game.enemiesVec[k].y -0.15f)) &amp;&amp; ((bullets[k].pos.y) &gt; (game.enemiesVec[k].y +0.15f)))){
     //do stuff            
     game.enemiesVec[k].x = 5;
            }
            }
    }
</code></pre>

<p>I'm clueless tbh, I know I need to somehow maybe get the radius of the object so it has a bigger area to collide with but I've no idea! </p>

<p>Hopefully someone can help!</p>