Settling on the control scheme for a cannon shooting mobile game

January 27th, 2016

Sometime during the mid-90s I spent some birthday gift money on Donkey Kong Country for the Super NES. It remains the most expensive game I've every purchased, and I was sorely disappointed when two days later I had completed the whole thing.

Not that it wasn't a swell ride. I remember enjoying the game's barrel cannon shooting sequences, where I'd blast the two simian protagonists, Donkey and Diddy Kong, from one barrel to the next while grabbing bananas. The barrels would move and rotate, so I'd have to time each blast perfectly to avoid falling to my doom or hitting various airborne enemies.

I make games for the iPhone and iPad in my tiny one-man operation, Dangobit. I haven't played Donkey Kong Country much since, but thinking back got me mulling over the idea of a game about shooting stuff between cannons, lack of originality be damned.

For my purposes, I'll refer to the player character or object being shot out of the cannons as the Dude. Correspondingly, the cannon holding the Dude will be referred to as the Dude Cannon. Three factors determine where the Dude will end up upon being shot out of a cannon: angle, power, and the location of the cannon. Each control method basically revolves around which of these factors are controlled by the player or the game itself.

Naturally, the ostensibly simple mechanic of shooting stuff out of a cannon proved much more complicated once the creative juices started flowing. Discovering the limitations of one method will lead to the next, so I'll present the methods chronologically, as well as explain the thoughts that lead me from one to the next.

Method one: Tap the cannon

The simplest of control schemes. Neither power nor angle are controlled by the player.

This is the most simplistic method, but also the most limiting. There would only be one possible way of shooting to the next cannon, so any challenge would have to come from obstacles and enemies — timing would be the only factor within the player's control.

Incidentally, should the Dude Cannon only fire when tapping the cannon itself, or when tapping any free spot on the screen? On one hand, by responding only to direct cannon taps, the player's finger is more directly in touch with the object he's manipulating, making for a more immersive experience. On the other, it also obscures the player's view of the cannon and potentially other important objects. Compromises, compromises.

Method two: Power meter, shoot on tap

When the Dude enters a cannon, a power meter appears and automatically and gradually increases to its maximum value, decreases back down to zero, then increases again, etc. When the player taps, the Dude Cannon fires with the amount of power corresponding to the meter's value at that time. The cannon is rotated at a certain angle outside the player's control.

A power meter that automatically increases and decreases should work fine with stationary cannons, but what happens if cannons are in motion? Say the Dude Cannon is on the left side of the screen, pointing to the right and moving up and down. On the other side of the screen is the cannon you're trying to hit, also moving up and down. Since the Dude would start falling under gravity's pull as soon as airborne, the Dude Cannon would have to be higher up than the destination cannon at the time of firing to score a hit. But since power is now a factor — controlled by the automatic meter — the timing of this now comes into play. What if power and cannon placements never match at a time when a hit can be scored? Enter method three...

Method three: Tap-and-hold to set power, shoot on release

Here, the power meter from the previous method still automatically increases and decreases, but it only starts doing so when the player's finger hits the screen. When the player releases his finger, the cannon fires. This allows the player to time the shot when cannons are in motion.

But what if the player summons the power meter at the wrong time? There needs to be a way to abort once a touch has been initiated. One way is to have the power meter pause momentarily whenever it reaches zero power, or having the lowest 10% of power be equal to no power. This would give the player time to remove his finger without firing, but would have to be clearly communicated in order to avoid frustration.

Method four: Swipe to set angle and/or power

The Dude is gobbled up by a cannon. The player then initiates a swipe, the direction and length of which determine the angle and power of the cannon blast.

My first thought was I think was to have the player start swiping from the Dude Cannon. If the player swipes to the right, the cannon will shoot to the right; if the player swipes diagonally upward, the cannon will shoot diagonally upward, etc. The farther away from the cannon the player removes his finger, the more power. Ending a swipe back at the cannon — where the swipe was initiated — would abort a blast.

For my purposes, I want to be able to position a cannon anywhere and have it fire in any direction. Using this method, how will I then shoot upward out of a cannon placed at the top of the screen? Or downward from a cannon at the bottom? My finger would exit the screen, initiating a blast at the amount of power corresponding to the cannon's distance from the edge of the screen. Not good.

Nor would this do with moving cannons. If power is determined by the swiping finger's distance to the Dude Cannon, power and angle would fluctuate as the cannon moved around the screen, making it much harder for the player to arrive at the desired amount at the right time.

One solution to both of the above problems would be to allow swipes to start anywhere on the screen instead of just from the Dude Cannon. Angle and power would still be determined by the angle and length of the swipe, and lifting the finger at about the same spot as it was placed would abort.

Method five: Tap — power and angle relative to Dude Cannon

A simplification of the swipe action from method four. Power and angle are calculated by the finger's distance and angle from the Dude Cannon at the moment of the tap.

Firing the cannon when the player lifts the finger from the screen, as opposed to when he touches it, will allow the player to tweak the angle and power while his finger is pressed to the screen.

As before, the location of the Dude Cannon at the moment of fire is an issue. A cannon placed near the top of the screen won't be able to fire upwards. Also, how do I abort fire? I could place an Abort button at the corner of the screen, but having to potentially swipe across the entire screen to abort a firing strikes me as cumbersome.

Method six: Manual power, automatic angle

Last up is implementing manual setting of power through a meter at the edge of the screen. The meter is just a thin vertical bar with a draggable indicator.

Dragging the indicator up and down changes power. Releasing it fires the Dude Cannon and resets the indicator to zero. Zero is actually placed some distance from the bottom of the screen, so releasing at any point on the bottom, say, 10% of the screen results in an aborted firing. This way the player can flick the indicator to the bottom without worrying if he accidently set the power to one or two instead of zero.

I could have let the indicator stay at its position when released instead of resetting to zero (10% up the screen), but then I'd run into problems with the iPhone's system of drawers that appear whenever you swipe inward from a screen edge. For instance, swiping from the bottom reveals settings for screen brightness, volume, etc. so if the player had released the indicator at the very bottom of the screen, he might inadvertently reveal the drawer when grabbing the indicator the next time.

I had originally implemented a separate fire button, but while firing upon releasing the indicator may prove jarring the first time it happens, would be preferable to having to tap another button every time the player shoots.


Wow, that's a lot of words about shooting stuff out of a cannon. Some of the methods can be combined, and no doubt more tweaking would have to be done once more game elements come into play. I haven't even decided where I'll end up with this yet, but take it for what it's worth.

Share