Original Post
i have a method that holds a constructor for a bullet
[source lang="java"] class Bullet
{
int x;
int y;
int width;
int height;
int bxspeed;
public Bullet(int x, int y, int width, int height, int bxspeed)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}//end ball
public void paintBullet(Graphics g)
{
g.setColor(Color.blue);
g.fillRect(spaceShip.xpos, spaceShip.ypos, 20, 10);
}
} [/source]
and when the enter key is pressed, i want a bullet to be created at the middle of the spaceShip, but whenever i create one it starts at the top left corner of the spaceship
[source lang="java"] class Bullet
{
int x;
int y;
int width;
int height;
int bxspeed;
public Bullet(int x, int y, int width, int height, int bxspeed)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}//end ball
public void paintBullet(Graphics g)
{
g.setColor(Color.blue);
g.fillRect(spaceShip.xpos, spaceShip.ypos, 20, 10);
}
} [/source]
and when the enter key is pressed, i want a bullet to be created at the middle of the spaceShip, but whenever i create one it starts at the top left corner of the spaceship