So far I am just making a new Shape to "move" it. But is there a better way to change the position of a Shape in Java?
// Collision Shape
protected RectangularShape col;
public GameObject() {
col = new Ellipse2D.Double(x, y, ObjectSpriteManager.SIZE, ObjectSpriteManager.SIZE);
}
public void tick() {
x += velX;
y += velY;
col = new Ellipse2D.Double(x, y, ObjectSpriteManager.SIZE, ObjectSpriteManager.SIZE);
}
See the
setFrame()
methods ofRectangulerShape
. For example: