Advertisement
Guest User

Luuk

a guest
Jun 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. public boolean onTouchEvent(MotionEvent event) {
  2. Log.i(LOG_TAG, "Canvas touched");
  3. if (event.getAction() == MotionEvent.ACTION_DOWN) {
  4. if (event.getX() > 960) {
  5. Log.i(LOG_TAG, "Moving player right");
  6. gameEngine.onRelease();
  7. gameEngine.onClickRight();
  8. } else {
  9. Log.i(LOG_TAG, "Moving player left");
  10. gameEngine.onRelease();
  11. gameEngine.onClickLeft();
  12. }
  13. }
  14.  
  15. if (event.getAction() == MotionEvent.ACTION_UP) {
  16. gameEngine.onRelease();
  17. }
  18.  
  19. return super.onTouchEvent(event);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement