Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package genericzombieshooter.structures;
- import java.awt.Point;
- import java.awt.geom.AffineTransform;
- import java.awt.geom.Rectangle2D;
- import java.awt.image.BufferedImage;
- import java.io.File;
- import java.io.IOException;
- import javax.imageio.ImageIO;
- /**
- *
- * @author packetpirate
- */
- public class Particle extends Rectangle2D.Double {
- // Member variables.
- private Point target;
- private AffineTransform af;
- private BufferedImage img;
- public Particle() {
- super();
- target = new Point();
- af = new AffineTransform();
- img = null;
- }
- public Particle(double x_, double y_, double w_, double h_) {
- super(x_, y_, w_, h_);
- target = new Point();
- af = new AffineTransform();
- img = null;
- }
- public Particle(double x_, double y_, double w_, double h_, Point target_) {
- super(x_, y_, w_, h_);
- target = target_;
- af = new AffineTransform();
- img = null;
- }
- public Particle(double x_, double y_, double w_, double h_, Point target_, String fileName_) {
- super(x_, y_, w_, h_);
- target = target_;
- af = new AffineTransform();
- LoadImage(fileName_);
- }
- private void LoadImage(String fileName_) {
- try {
- img = ImageIO.read(new File(fileName_));
- } catch(IOException io) {
- System.out.println("File not found!");
- }
- }
- public Point getTarget() { return target; }
- public void setTarget(Point target_) { target = target_; }
- public AffineTransform getTransform() { return af; }
- public BufferedImage getImage() { return img; }
- // Shape manipulation.
- public void rotate(double theta_, double cx_, double cy_) { af.setToRotation(theta_, cx_, cy_); }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement