use of com.hackerhop.game.core.MainController in project HackerHop by nicovank.
the class GameOverScene method keyDown.
@Override
public boolean keyDown(int keycode) {
if (keycode == Input.Keys.ESCAPE) {
MainController controller = super.getController();
controller.setScene(new MainMenu(controller));
}
return true;
}
use of com.hackerhop.game.core.MainController in project HackerHop by nicovank.
the class GameScene method keyDown.
/**
* Called when a key is pressed.
*
* @param keycode The code of the pressed key.
* @return whether the input was processed.
*/
@Override
public boolean keyDown(int keycode) {
if (keycode == Input.Keys.A || keycode == Input.Keys.LEFT) {
player.getBody().applyForceToCenter(new Vec2(-5000f, 0f));
player.setDirection(Direction.LEFT);
}
if (keycode == Input.Keys.D || keycode == Input.Keys.RIGHT) {
player.getBody().applyForceToCenter(new Vec2(5000f, 0f));
player.setDirection(Direction.RIGHT);
}
if (keycode == Input.Keys.SPACE || keycode == Input.Keys.UP) {
player.getBody().applyForceToCenter(new Vec2(0f, 5000f));
jump.play(0.2f);
}
if (keycode == Input.Keys.ESCAPE) {
MainController controller = super.getController();
controller.setScene(new MainMenu(controller));
}
return true;
}
use of com.hackerhop.game.core.MainController in project HackerHop by nicovank.
the class MainMenu method touchDown.
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
int y = Gdx.graphics.getHeight() - screenY;
MainController controller = super.getController();
if (sprite1.getBoundingRectangle().contains(screenX, y)) {
controller.setScene(new GameScene(controller, Character.ROB));
} else if (sprite2.getBoundingRectangle().contains(screenX, y)) {
controller.setScene(new GameScene(controller, Character.NICK));
} else if (sprite3.getBoundingRectangle().contains(screenX, y)) {
controller.setScene(new GameScene(controller, Character.KATIE));
} else if (sprite4.getBoundingRectangle().contains(screenX, y)) {
controller.setScene(new GameScene(controller, Character.YE));
} else if (gitHubButton.getBoundingRectangle().contains(screenX, y)) {
try {
openWebpage(new URL("https://github.com/nicovank/HackerHop"));
} catch (MalformedURLException ignored) {
}
}
return true;
}
use of com.hackerhop.game.core.MainController in project HackerHop by nicovank.
the class GameDesktop method main.
public static void main(String[] args) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.height = 720;
config.width = 540;
config.resizable = false;
new LwjglApplication(new MainController(), config);
}
Aggregations