Skip to content

Instantly share code, notes, and snippets.

@danleyb2
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danleyb2/f9a355cbf584ae09e180 to your computer and use it in GitHub Desktop.
Save danleyb2/f9a355cbf584ae09e180 to your computer and use it in GitHub Desktop.
import java.awt.*;
import javax.swing.ImageIcon;
public class Bullet {
int x,y;
Image img;
boolean visible;
public Bullet(int startX, int startY)
{
x = startX;
y = startY;
ImageIcon newBullet = new ImageIcon("bullets1.jpg");
img = newBullet.getImage();
visible = true;
}
public Rectangle getBounds()
{
return new Rectangle(x,y, 19, 23);
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public boolean getVisible()
{
return visible;
}
public Image getImage()
{
return img;
}
public void move()
{
x = x + 2;
if ( x > 700)
visible = false;
}
public void setVisible(boolean isVisible)//down
{
visible = isVisible;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment