Last active
August 29, 2015 14:20
-
-
Save danleyb2/f9a355cbf584ae09e180 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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