Skip to content

Instantly share code, notes, and snippets.

@codingricky
Created February 17, 2014 02:29
Show Gist options
  • Save codingricky/9043689 to your computer and use it in GitHub Desktop.
Save codingricky/9043689 to your computer and use it in GitHub Desktop.
package com.github.codingricky.leapmotion;
import com.leapmotion.leap.Controller;
import org.skree.brickattack.Game;
import org.skree.brickattack.PaddleEntity;
public class LeapMotionGame extends Game {
private static final int MOVEMENT_MULTIPLIER = 4;
private final Controller controller;
private final LeapMotionListener listener;
public LeapMotionGame() {
listener = new LeapMotionListener();
controller = new Controller(listener);
}
@Override
protected void movePaddle(PaddleEntity paddle) {
paddle.setHorizontalSpeed(listener.getX() * MOVEMENT_MULTIPLIER);
}
public static void main(String[] args) {
final LeapMotionGame leapMotionGame = new LeapMotionGame();
leapMotionGame.gameLoop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment