How can I stop an image from moving and cause an action based on a keystroke?
<p>I am 12 years old.  I am teaching myself web programming.  I'm also working on C++.  I am having a problem with Javascript.</p>

<p>I need to know how to create an "if statement" based on the location of an image.</p>

<p>I am making a simple game that has a cannon that is moving back and forth.  I want the user to press a button that will cause the cannon to stop and fire launching another image toward the target.</p>

<p>I have already created the images and a gif of the image that will travel from the cannon in an arc toward the target.</p>

<p>If the user fires when the cannon is in the correct position the image will hit the target.</p>

<p>Can someone tell me how to create an if statement based on position?  Or can someone tell me how to make the cannon stop and make the gif appear?</p>
