Shooting Gallery

In this shooting gallery game, you control the pivoting gun turret with a motion-sensitive hand controller.  Pivot your hand left and right to aim the gun, and squeeze the finger trigger to shoot.

The game picks two targets at random and raises them in sequence for you to try to shoot with your two darts. You have about a second to try to shoot each one before it goes back down. The program detects hits using the sensors in the motors and shows how many hits you got at the end of each round.

See detailed instructions for playing the game below.

Building Instructions

Gun Turret

Hand Controller

Shooting Gallery

Programming

Playing the Game

Important: Before you run the program on the hub, set the hand controller down on the table and align it so that it is aiming down the center of the two targets. When you press the hub button to start the program, the program will measure the (yaw) angle of the controller to calibrate which direction is center. The hand controller uses the gyro sensor, so see this note if you have problems.


When the game is ready to play, it will play a sound and turn the hub button yellow. You can then load the two darts and then pick up the controller and practice aiming. When you are ready for a round, aim straight ahead and press the left arrow button on the hub.


Important: You must aim straight ahead between the two targets while you are waiting for one to raise. If you try to aim to one side early, the hub will display a red light and wait for you to center your aim. This keeps you from trying to guess and aim early.


Once your aim is centered, the game will wait a random amount of time then pick a random target and raise it. You have about a second to try to hit the target before it goes back down. Then a second target is picked and raised.


At the end of a round (two targets), the number of hits is displayed on the hub. The hit detection is not perfect. The program has to wait for the target to stop vibrating after raising it, so if you shoot too early, it might not detect it. To start the next round, reload the darts and then press the left arrow button. Rounds repeat until you end the program with the hub center button.