package edu.stuy.starlorn.entities;

/*
 * An object moving around the world. This shouldn't be used directly -- It should be subclassed and extended.
 */
public class Entity {
    private double _x, _y;
    private int _width, _height;

    public Entity(double x, double y, int width, int height) {
        _x = x;
        _y = y;
        _width = width;
        _height = height;
    }

    public Entity(double x, double y) {
        this(x, y, 0, 0);
    }

    public Entity() {
        this(0,0);
    }

    /* 
     * Used for handling things that need to be done before anyone takes action.
     */
    public void preStep() {
    }

    /*
     * Used for taking actions (moving, shooting, etc)
     */
    public void step() {
        System.out.printf("X: %.1f, Y: %.1f\n",getX(), getY());
        setXY(getX()-1 + Math.random() * 2, getY()-1 + Math.random() * 2);
    }

    /*
     * Used for cleanup after the step
     */
    public void postStep() {
    }

    public void setX(double x) {
        _x = x;
    }
    public double getX() {
        return _x;
    }

    public void setY(double y) {
        _y = y;
    }
    public double getY() {
        return _y;
    }

    public void setWidth(int width) {
        _width = width;
    }
    public int getWidth() {
        return _width;
    }

    public void setHeight(int height) {
        _height = height;
    }
    public int getHeight() {
        return _height;
    }

    public void setXY(double x, double y) {
        setX(x);
        setY(y);
    }
}

@@ -621,32 +621,96 @@
 oid preStep() %7B%0A
+        System.out.printf(%22X: %25.1f, Y: %25.1f%5Cn%22,getX(), getY());%0A
     %7D%0A%0A    /*%0A  
@@ -799,72 +799,8 @@
 ) %7B%0A
-        System.out.printf(%22X: %25.1f, Y: %25.1f%5Cn%22,getX(), getY());%0A
     

Move debug output for Entity to preStep