Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package objects;
- import java.awt.Image;
- import javax.swing.ImageIcon;
- @SuppressWarnings("all")
- public class Missile {
- int x, y;
- Image image;
- boolean visible;
- int screenWidth = 600;
- int speedMissile = 3;
- public Missile(int x, int y){
- ImageIcon ii = new ImageIcon(this.getClass().getResource("/image/missile.png"));
- Image image = ii.getImage();
- visible = true;
- this.x = x;
- this.y = y;
- }
- public Image getImage() {
- return image;
- }
- public int getX() {
- return x;
- }
- public int getY() {
- return y;
- }
- public boolean isVisible() {
- return visible;
- }
- public void move(){
- x += speedMissile;
- if (x > screenWidth)
- visible = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement