I am basically making a battleship guessing game where you have to the position of a ship by the click of your mouse. When a position of the ship is guessed correctly it deletes that ship cell from the array and when every cell is guessed correctly, the game is over.
What I am now struggling on is to
- keep the ship cells within the canvas
- convert the mouse position in pixels into the row and column on the grid
- if the guess is correct, add the guess to the hit array and if missed adding it to the miss array.
- when a guess is made, in addition to colouring the cell, print either “Hit!” or “Miss!” on the cell
- sinking the ship when all cells have been hit