final/src/Particle.java

33 lines
801 B
Java

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
public class Particle extends GenericSprite{
public static final int small = 3;
public static final int big = 10;
public int xVelocity;
public int yVelocity;
public int lifeSpan = 10;
public BufferedImage sprite;
public Particle(int x, int y, int xVelocity, int yVelocity, int length, String filePath) throws IOException {
super(x,y,length, length);
this.xVelocity = xVelocity;
this.yVelocity = yVelocity;
sprite = GamePanel.getImage(filePath);
}
public void move(){
x+=xVelocity;
y+=yVelocity;
yVelocity+=0.5;
}
public void draw(Graphics g){
g.drawImage(sprite,x-GamePanel.camera.x,y,WIDTH,HEIGHT, null);
}
}