Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package OurGame;
- import java.awt.*;
- import javax.swing.ImageIcon;
- public class Bullet {
- int x, y;
- Image img;
- boolean visible = true;
- public Bullet(int startX, int startY)
- {
- x = startX;
- y = startY;
- ImageIcon newBullet = new ImageIcon("bullet.png");
- img = newBullet.getImage();
- visible = true;
- }
- public Rectangle getBounds()
- {
- return new Rectangle(x,y, 44, 24);
- }
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement