Battleship Captivate Game and Javascript


Sometimes, we wonder if we can and don’t stop to think if we should. I wanted to create a course that would change somehow every time the learner would take it. It has no practical use other than to see if I can make it work and sometimes – that’s the best course to make.

The start of the screen. The learner clicks each box. The boats will be random.

If it’s a hit – the box turns red.

The boats will generated within these four sections.

On slide enter, I have a java script function for a random number for the start of the boat on the grid (Hit1A), etc. The rest of the boat (Hit1B, Hit1C) is generated based on the boat direction and grid number (+1, +2. etc.) or for the vertical boats (+15, +30).

Variables are preloaded for attempts allowed, attempts counts, boat length, etc. If we tie this to a quiz (e.g., score better = more attempts), then learning somewhere can be applied.

Hit2x variabled connect the dots to the boat and if the gridblocked. is clicked.

On the grid block, a shared action was created to change the hit state, based on the grid number.

Leave a Reply