Created
February 17, 2014 02:29
-
-
Save codingricky/9043689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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