Quizzing is a huge part of e-learning course development, because you want to know if learners have understood the material. That makes sense! But that doesn’t mean your quizzes have to be boring. Take this e-learning battleship game, for example. When you strip away the game elements, it’s just a simple quiz. But to your learners, the game elements can mean the difference between a snoozefest and a fun and meaningful learning experience!

In this article, I’ll show you how I built this from A to Z. Don’t be put off by the number of steps—it’s a lot easier than it looks. If you’ve been wanting to give e-learning games a go, but have been too intimidated by triggers and variables, this step-by-step tutorial is the perfect jumping-off point. The detailed explanations and screenshots will ensure you get it right the first time. Here we go!

## 1. Create Player Grids and Ships

First, you’ll create your gameboard. To do this, just insert the number of squares needed using the “insert shapes” feature, and arrange them in a grid. The squares on the left (in the learner’s grid) should have no fill color. The squares on the right (in the enemy’s grid) should have the same fill color as the slide background. I’ll explain why later on in this article.

Before moving on, you should create a naming convention for your squares. This will make the rest of the process much easier. In this example, I’ve given each row a letter and each column a number, as pictured below.

The left grid squares are named as follows (from left to right and top to bottom): W1, W2, W3, W4, X1, X2, and so on.

Next, design your ships using a combination of shapes, or insert them as images. The number and size of your ships depends on how many quiz questions you’d like to include. Each player should have the same number of ships and squares overlapped. (In my example, each player has three ships that span eight squares, so I have eight total questions.) Then place your ships on the grids as desired. When the learner clicks on these squares, they will be brought to the corresponding question slide.

Once your ships are in place, make a list of all the squares the learner’s ships and the enemy’s ships are on. My list looks like this:

We’ll use this list later, so keep it handy!

## 2. Add Visual Feedback to Squares

Now that your player grids are set up, it’s time to add states to your squares. These serve as visual cues to the learners about how they’re doing. The real Battleship game offers only two possibilities: players either hit or miss their enemy’s ships. For the e-learning version, I created this third option: If learners find the ship but get the corresponding question wrong, they don’t get the points. For each square I created custom states named hit (correct answer), miss (no ship is present), and misfire (incorrect answer). If you’re not sure how to add states to an object, check out this tutorial before moving on.

For the hit and miss states, I inserted a colored explosion shape—red for hit, blue for miss—and changed the fill color of the rectangle to None, so the square is transparent. Note that all of the learner squares are already transparent, so only the enemy square hit and miss states needed to be adjusted at this level. You’ll see why later on. For the misfire state, I combined a circle and four lines to create a crosshair icon. Here’s a quick look at my square states:

Since the squares in the learner’s grid are transparent and the squares in the enemy’s grid have a fill color, the states look slightly different.

## 3. Add Interactivity to Empty Enemy Squares

Now let’s add the interactivity, starting with the enemy squares without ships on them. For each of these squares, we’ll add a trigger so that when the learner clicks, the miss state will appear. (If you’re new to triggers, read this tutorial to see how they work.) Here’s what it should look like:

To add this trigger to all of the other empty squares on the enemy’s grid, simply select the trigger, click Copy Trigger, select all of the other empty squares, and choose Paste Trigger. It’s that easy!

## 4. Create Variables for Enemy Squares with Ships

Remember that list of squares with ships on it we made earlier? It’s time to get that out! We’re going to create a number variable for each of the squares in the enemy’s ships column with a default value of 1. (To learn more about adding variables, see this tutorial.) Once I created all of my variables, the variable manager window looked like this:

These variables will allow us to change the state of the squares on the player grids to hit or misfire, depending on the learner’s answers. We’ll see how in Step 5.

## 5. Insert Your First Quiz Slide

The next step is to create your first quiz slide. I chose to create a freeform pick-one question, but you can use any kind of question you’d like. Use the same name for your quiz slide as for the corresponding square.

The first step in making player grids function correctly is to adjust the variables created earlier by adding a trigger on each feedback layer. On the correct layer, insert a trigger that adjusts the variable with the same name to add 1 when the timeline starts (in this example I’m on slide A2, so I’ll adjust variable A2). It should look like this:

You’ll also want to change the “jump to” trigger on the continue button so when your learner clicks on it, they go back to the gameboard instead of to the next slide.

On the incorrect layer, we’re going to add a similar trigger, except this time we’ll subtract 1 instead of adding 1. It should look like this:

Don’t forget to change the “jump to” trigger on the incorrect layer as well, so learners go back to the gameboard when they click Continue.

## 6. Duplicate Quiz Slides

Now that you’ve created one quiz slide, you can duplicate it for all of your other questions, assuming you’re using the same question type. Once you’ve duplicated the question slides, change the titles so they match the names of the different squares, then change the variable referenced in the trigger on both the correct and incorrect slides using the drop-down menu.

Once you’ve done that for all of your question slides, you’re ready for Step 7!

## 7. Bring Your Gameboard to Life

It’s time to go back to the gameboard and make the magic happen. First you’ll need to link your squares to your question slides. To do this, set up a trigger with a condition for each enemy square with a ship on it (column 2 on your list). The trigger should jump to the corresponding slide when the user clicks, if the state of the square is equal to normal. (Click here to find out more about trigger conditions.) It should look like this:

Remember, you can use the trigger copy/paste buttons to get this done faster. Just make sure to change the slide reference so the button leads to the correct question.

Next we’re going to add triggers to make the squares with ships on them change states (hit or misfire) depending on the learner’s answer. For each of these squares (see column 2 of your list once again), you’ll create two slide triggers with conditions, with an optional third trigger. Slide triggers rely on the slide’s timeline to make something happen. (To learn more about slide triggers, click here.)

The first slide trigger will adjust the state of the square to misfire when the timeline starts if the value of the associated variable is equal to 0, as pictured below.

This trigger will ensure that when a learner responds incorrectly, they will see the crosshair icon we created earlier.

This next slide trigger will do the opposite: show the explosion icon when the learner responds correctly. It’s set up in almost exactly the same way, but this time you’ll have it adjust the state of the square to hit when the timeline starts if the value of the associated variable is equal to 2, as you can see below.

The third slide trigger is optional. If you do set it up, then when the learner responds incorrectly, not only will they not hit their enemy’s ship but their enemy will hit their ship. In order to make this happen, you’ll have to link each enemy square with a ship on it to one of the learner’s squares with a ship on it. To do this, take out your list once again. You could just link the ships in the order they are written on your list, or you could randomize, like I did. It’s completely up to you. This is how I did it:

Once I decided which squares to link, I duplicated the first slide trigger and changed the state to misfire, changed the object reference from A2 to X3, and changed the state to hit, as you can see in the screenshot below.

Now when the learner answers incorrectly, they’ll see a crosshair on one of their enemy’s ships and an explosion on one of their ships.

Phew! Your gameboard is set up. Time to select all of the ships, then right-click and select Send to Back to ensure that the states on the squares appear on top of the ships instead of underneath them.

Since the squares on the learner’s grid are transparent, they can still see their ships, while the enemy squares have a fill, so their ships are hidden until the learner uncovers them.

Last but not least, change the slide properties to "resume saved state" so that when the learner comes back to the gameboard after answering a question, the state changes remain intact.

## 8. Set Up Results Slide

Next, insert a graded results slide. Make sure all of the questions in your project are selected and adjust the passing score. For my quiz, I chose 62% because I wanted the learner to have to get five out of eight questions correct to pass.

For my results slide, I unchecked the “show passing score” and “review quiz” options and selected the “retry quiz” option.

I only wanted the points to show, not the percentage, so I deleted the score percent variable reference, leaving only the score points variable reference.

Then I deleted all of the text labels on the base layer and the success layers, inserted my own, and adjusted the layout.

Then I created a true/false variable with a default value of false; this allows me to reset my gameboard if the learner wants to try again.

I then added a trigger to the retry button to change the value of this variable to true when the user clicks.

I also added a trigger to reset the value of each of the other custom variables to 1, so that the states on my gameboard squares will work as they did the first time around.

Remember, you can use the copy/paste trigger icon to do this more quickly. If you use that method, then all you have to do is select the appropriate variable from the drop-down menu.

Once you’ve added all of the triggers, you’ll want to adjust the “jump to” trigger so that it takes the learner back to the gameboard. You’ll also want to make sure that this trigger is the last trigger in the list.

If it isn’t the last one in the list, the learner will be brought to the gameboard prematurely, before all of the variables are adjusted, as the triggers are executed in order from top to bottom. If that happens, the gameboard won’t be reset when they arrive.

## 9. Add “Game Over” Message

Now it’s time to add a layer on your gameboard to let learners know when they have found all of the enemy’s ships. On my layer, I’ve added a rectangle to cover the text on the base layer, some explanations and instructions for the learner, a button to take them to the results page, and an arrow to draw attention to the button. On my button, I’ve added a trigger to hide the layer and jump to the results slide when they click.

That way, if they decide to try again, this layer will not appear when they return to the gameboard.

Back on the base layer, add a slide trigger to show the layer when the states of all of the enemy squares with ships underneath are not equal to normal.

That way, once the learner has clicked on all of them (meaning the states are now either hit or misfire), the “game over” layer will appear.

## 10. Finalize Gameboard Reset

Almost there! To force the enemy squares to reset, add a slide trigger changing the state of all of the enemy squares (with and without ships on them) and all of the learner squares with ships on them to normal if the value of the retry variable is equal to true.

That way, if the learner decides to give it another try, the gameboard will be blank.

The last step is to add a slide trigger to change the retry variable back to false, so the gameboard doesn’t continue to reset itself each time the learner answers a question and comes back to the gameboard.

Make sure that this trigger is the last in the list of triggers, just before the list of object triggers. Otherwise, the value of the retry variable will be changed to false too early, and the board will not reset correctly.

And there you have it: your very own e-learning battleship game! I hope you had as much fun creating it as I did. Pat yourself on the back; your learners are going to love it. If you liked this example but don’t have time to build it yourself, no problem! We’ve made it available for free: download here.