title: How to add Score to a game
body: <p>I am trying to add a score feature to my game. I know that where I have a remove function I now need to add code which means that whenever an enemy is removed it contributes to the score of the game but I don't know how to implement that into my game using code. Below I have included relevant code. </p>
  
  <pre><code>      boolean alive() {
          for (int i = 0; i &lt; bullets.size(); i++) {
            Bullet bullet = (Bullet) bullets.get(i);
            if (bullet.x &gt; x &amp;&amp; bullet.x &lt; x + pixelsize * 7 &amp;&amp; bullet.y &gt; y &amp;&amp; bullet.y &lt; y + 5 * pixelsize) {
              bullets.remove(i);
              bullet.alive = false;
              return false;
            }
          }
          for (int i = 0; i &lt; bullets.size(); i++) {
            Bullet bullet = (Bullet) bullets.get(i);
            if (bullet.alive == false) {
              bullets.remove(i);
            }
          }
          return true;
        }
  </code></pre>