package model_pkg.gameobject_pkg;
import def_classes.Box;
import def_classes.Point;
import display_pkg.SpriteSheet;
/**
* Factory class for creating Balloons.
* For usage directions, see <i>GameObjectFactory</i>.
* @author Johansson M.
*/
public class BalloonFactory extends GameObjectFactory {
private static SpriteSheet spriteSheet; // The sprite sheet
private static Point templateStartPosition; // The start position
private static Box templateBoundingBox; // The bounding-box
private static BalloonFactory me;
private BalloonFactory() {
templateBoundingBox = new Box(1, 1, 51, 64);
}
public static BalloonFactory getFactory() {
if (me == null) {
me = new BalloonFactory();
}
return me;
}
public static void setTemplateSpriteSheet(SpriteSheet sheet) {
spriteSheet = sheet;
}
public static void setTemplatePosition(Point pos) {
templateStartPosition = pos;
}
public Balloon instantiate() {
System.out.println(templateStartPosition.getIntX() + ", " + templateStartPosition.getIntY());
Balloon balloon = new Balloon(
templateStartPosition.getIntX(),
templateStartPosition.getIntY(),
templateBoundingBox,
spriteSheet);
return balloon;
}
}