I'm currently teaching myself web programming and also working on improving my C++ skills. However, I am facing a challenge with Javascript.
My main question is regarding how to create an "if statement" based on the location of an image.
I am in the process of developing a simple game where a cannon moves back and forth. The goal is for the user to press a button that stops the cannon and fires another image towards a target.
So far, I have created the images as well as a gif depicting the image moving from the cannon towards the target in an arc.
If the user manages to fire at the right moment when the cannon is in position, the image will hit the target successfully.
Could anyone provide guidance on creating an if statement based on the position? Alternatively, can someone explain how to stop the cannon and display the gif once fired?