Upon getting the leap motion sensor from the hardware lab, we wanted to utilize it to control a virtual object, possibly linking it to some game. We thought that a game like breakout, with the user controlling the paddle, would work well with the sensor.

What it does

This version of Breakout prompts the user for a difficulty level by asking for a show of fingers from 1 to 10, with the speed increasing with number. Then, the user can do a double click motion midair to initiate the game. Lastly, the paddle is controlled by moving the hand along the leap motion detection range.

How we built it

The first step was creating the actual Breakout game with the paddle following the mouse. Then we figured out the leap motion sensor and coordinate it with the program. Through the sensor, we pulled out the number of fingers the user held up for difficulty, whether the user starts the game, and the direction the hand was moving. All these parts came together to create a complete, working new-and-improved Breakout game.

Challenges we ran into

Although we created the breakout program fairly quickly, linking it with the leap motion proved to be difficult. We encountered many obstacles, one of which was figuring out the API and implementing parts that we needed - an unexpectedly difficult task given the large number of methods and classes. Another issue was the game loop. Our original design for the project was to have the motion of the paddle separate to the movement of the ball, possibly threading the program, but we ran into countless errors of the game not ending, starting too early, and sometimes not starting at all. Thus, we decided to use one game loop that refreshes every millisecond to control the whole process - movement of the ball and paddle and collisions with the wall and blocks.

Accomplishments that we're proud of

Frankly, we're quite proud of the fact that the program works. Sensors always have their own little instabilities and shaky times, and working around these problems while managing to draw information out live-time was a steep challenge.

What we learned

This hackathon, first for both of us, was a good learning experience in general. We came into contact with Leap-motion, learned how to use it, and integrated it into our very own program. This made us realize how we could use technology as well instead of relying on programming and nothing else.

What's next for Breakout

Well, of course the most immediate step is to implement more levels - the current set up is a mere group of blocks. We can also make this program more complex by adding random "boosts" or "slows" to heighten the difficulty of the game. Perhaps there could even be two paddles to be controlled with two hands!

Built With

Share this project: