public class BadSmellDude { double x,y ; double vx = 0.02 ; double vy = 0.02 ; public BadSmellDude() { x = 0.5 ; y = 0.5 ; } public BadSmellDude(double inx, double iny) { x = inx ; y = iny ; } public double getX() { return x ; } public double getY() { return y ; } public void Draw() { StdDraw.setPenColor(StdDraw.BLACK) ; StdDraw.filledCircle(x,y, 0.03) ; StdDraw.setPenColor(StdDraw.RED) ; StdDraw.line(x-0.02, y+0.02, x+0.02, y-0.02) ; StdDraw.line(x-0.02, y-0.02, x+0.02, y+0.02) ; } public void updateLocation() { char nextKey ; if (StdDraw.hasNextKeyTyped()) { nextKey = StdDraw.nextKeyTyped() ; if (nextKey == 'a') x -= vx ; if (nextKey == 'd') x += vx ; if ( nextKey == 's') y -= vy ; if ( nextKey == 'w') y += vy ; } } }