Workshop › Tower Defense › Step 39 of 42
A second kind of tower: the cannon. It costs more, shoots slower and not as far, but hits harder, and later its shots
will hit everything around the target (splash). Keys 1 and 2 choose which kind to build.
```js
arrow: { cost: 50, range: 2.5, damage: 4, reload: 24, splash: 0, color: '#38bdf8' },
cannon: { cost: 70, range: 2, damage: 8, reload: 60, splash: 1.2, color: '#f97316' },
if (event.key === '1') selected = 'arrow'
if (event.key === '2') selected = 'cannon'
```TOWERS, so building, range circles and shooting already work for the cannon.splash is a distance in tiles: 0 for arrows, 1.2 for cannons.'1' and '2' set selected, the kind the next click builds.TOWERS, add splash: 0, to arrow (before color) and write the cannon line under it.keydown listener, write the two key lines.Skills: Game states, Keyboard and mouse input
← Click to start Tower buttons →