Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Last active June 7, 2021 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/9060635953e7511f6896436b52434627 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/9060635953e7511f6896436b52434627 to your computer and use it in GitHub Desktop.
CTB 4-4
public void changePos() {
if (action_flg) {
boxY -= 20;
} else {
boxY += 20;
}
box.setY(boxY);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
action_flg = true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
action_flg = false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment