public void actionPerformed(ActionEvent e) {
        if (cf != fin) {

            //first frame is just x and y
            //the frames after that calculate change in width and height and then subtract the correct amount

            //gets the last value of tempX
            int temp = tempX;
            //updates tempX for the current Frame
            if (type == 1) {
                tempX = (int) Game.AnimationRectPLAYER1.getX();
            } else if (type == 2) {
                tempX = (int) Game.AnimationRectPLAYER2.getX();
            } else if (type == 3) {
                tempX = (int) Game.AnimationRectBOSS.getX();
            }
            //check for malfunctions 
            if (tempX == x || tempX == 0) {
                tempX = temp;
            }
            //same idea
            temp = tempY;
            if (type == 1) {
                tempY = (int) Game.AnimationRectPLAYER1.getY();
            } else if (type == 2) {
                tempY = (int) Game.AnimationRectPLAYER2.getY();
            } else if (type == 3) {
                tempY = (int) Game.AnimationRectBOSS.getY();
            }
            if (tempY == y || tempY == 0) {
                tempY = temp;
            }

            //so it has a referce for the first frame
            if (type == 1) {
                if (Game.p.getCF() == start) {
                    tempX = (int) Game.AnimationRectPLAYER1.getX();
                    tempY = (int) Game.AnimationRectPLAYER1.getY();
                }
                Game.p.setX((int) (x - (tempX - x)));
                Game.p.setY((int) (y - (tempY - y)));
            } else if (type == 2) {
                if (Game.p.getCF2() == start) {
                    tempX = (int) Game.AnimationRectPLAYER2.getX();
                    tempY = (int) Game.AnimationRectPLAYER2.getY();
                }
                Game.p.setX2((int) (x - (tempX - x)));
                Game.p.setY2((int) (y - (tempY - y)));
            } else if (type == 3) {
                if (Game.boss.getCF() == start) {
                    tempX = (int) Game.AnimationRectBOSS.getX();
                    tempY = (int) Game.AnimationRectBOSS.getY();
                }
                Game.boss.setX((int) (x - (tempX - x)));
                Game.boss.setY((int) (y - (tempY - y)));
            }


            Update();
        } else {
            //resets the picture to the original image
            Animation = false;
            if (type == 1) {
                Game.p.setX(x);
                Game.p.setY(y);
                Game.p.setCF(0);
            } else if (type == 2) {
                Game.p.setX2(x);
                Game.p.setY2(y);
                Game.p.setCF2(0);
            }else if (type == 3) {
                Game.boss.setX(x);
                Game.boss.setY(y);
                Game.boss.setCF(0);
            }
            time.stop();
        }
    }