Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created June 8, 2021 01:21
Embed
What would you like to do?
CTB 6-2
public void hitCheck() {
// Orange
float orangeCenterX = orangeX + orange.getWidth() / 2;
float orangeCenterY = orangeY + orange.getHeight() / 2;
if (0 <= orangeCenterX && orangeCenterX <= boxSize &&
boxY <= orangeCenterY && orangeCenterY <= boxY + boxSize) {
orangeX = -10.0f;
score += 10;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment