Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public boolean touchDown(int screenX, int screenY, int pointer, int button) {
- animationTime = 0;
- float width = Gdx.graphics.getWidth();
- velocity.x = speed * Math.signum(screenX - width / 2); // hard
- // velocity.x = speed * (screenX - width / 2) / width * 2; // fade
- float height = Gdx.graphics.getHeight();
- if(canJump && screenY < height / 2) { // experiment by changing the 2 to change how high the touch has to be to jump
- velocity.y = speed / 1.8f;
- canJump = false;
- }
- return true;
- }
- @Override
- public boolean touchUp(int screenX, int screenY, int pointer, int button) {
- animationTime = 0;
- velocity.x = 0;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement