Skip to content

Instantly share code, notes, and snippets.

@JanBerktold
Created January 12, 2016 22:32
Show Gist options
  • Save JanBerktold/e4f3e051dc7a6d19135d to your computer and use it in GitHub Desktop.
Save JanBerktold/e4f3e051dc7a6d19135d to your computer and use it in GitHub Desktop.
import java.awt.Color;
public class CircleTest
{
public static void main(String [] args)
{
EZ.initialize(800, 400);
EZCircle circle = EZ.addCircle(40, 40, 40, 40, Color.black, true);
while (true) {
if (circle.getXCenter() > EZ.getWindowWidth() || circle.getYCenter() > EZ.getWindowHeight()) {
circle.translateTo(40, 40);
}
if (EZInteraction.isMouseLeftButtonDown()) {
circle.translateBy(0, EZ.getDeltaTime() / 5);
} else {
circle.translateBy(EZ.getDeltaTime() / 5, 0);
}
if (EZInteraction.wasKeyPressed('b')) {
circle.setColor(Color.blue);
} else if (EZInteraction.wasKeyPressed('s')) {
circle.setColor(Color.black);
} else if (EZInteraction.wasKeyPressed('g')) {
circle.setColor(Color.green);
}
EZ.refreshScreen();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment