By using this site, you agree to our Privacy Policy and our Terms of Use. Close

public class SpaceShip extends(implements if Body is an Interface) Body
{
private float posX;
private float posY;

public SpaceShip(float inPosX, float inPosY)
{
posX = inPosX;
posY = inPosY;
}

public float getXPos()
{
return posX;
}

public float getYPos()
{
return posY;
}
}


//Code that utilizes this.
SpaceShip ss = new SpaceShip(originX, originY);
yVelocity = y-ss.getYPos();
xVelocity = x-ss.getXPos();