/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { this.container = container; rect = new Rectangle(400,100,200,150); round = new RoundedRectangle(150,100,200,150,50); round2 = new RoundedRectangle(150,300,200,150,50); center = new Rectangle(350,250,100,100); poly = new Polygon(); poly.addPoint(400,350); poly.addPoint(550,320); poly.addPoint(600,380); poly.addPoint(620,450); poly.addPoint(500,450); gradient = new GradientFill(0,-75,Color.red,0,75,Color.yellow,true); gradient2 = new GradientFill(0,-75,Color.blue,0,75,Color.white,true); gradient4 = new GradientFill(-50,-40,Color.green,50,40,Color.cyan,true); }
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { this.container = container; image1 = new Image("testdata/grass.png"); image2 = new Image("testdata/rocks.png"); fill = new GradientFill(-64,0,new Color(1,1,1,1f),64,0,new Color(0,0,0,0)); shape = new Rectangle(336,236,128,128); poly = new Polygon(); poly.addPoint(320,220); poly.addPoint(350,200); poly.addPoint(450,200); poly.addPoint(480,220); poly.addPoint(420,400); poly.addPoint(400,390); }
public GUI(GameContainer container, int x, int y) { super(container); setLocation(x, y); Font buttonFont = new TrueTypeFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 14), true); //North and south speedUp = new TextButton(container, "Speed Up", getCompX(0), getCompY(0), buttonFont); speedDown = new TextButton(container, "Speed Down", getCompX(speedUp.getWidth() + 30), getCompY(0), buttonFont); pause = new TextButton(container, "Pause", getCompX(0), speedUp.getY() + speedUp.getHeight() + 10, buttonFont); restart = new TextButton(container, "Restart", speedDown.getX(), speedUp.getY() + speedUp.getHeight() + 10, buttonFont); euler = new TextButton(container, "Angle set: " + getAngleSet(), getCompX(0), pause.getY() + pause.getHeight() + 10, buttonFont); hemisphere = new TextButton(container, getHemisphereText(), getCompX(0), euler.getY() + euler.getHeight() + 10, buttonFont); close = new TextButton(container, "X", speedDown.getX() + speedDown.getWidth() + 50, getCompY(0), buttonFont); contents = new Rectangle(x - 5, y - 5, width, height); sf = new GradientFill(0, 0, new Color(10, 10, 10, 200), width, 0, new Color(60, 60, 60, 200)); }
public Bullet(Vector2f initPos){ this.position = initPos.copy(); this.dir = new Vector2f(0, -2); this.shape = new Circle(this.position.x, this.position.y, 5); this.fill = new GradientFill(-10, -10, Color.white, 10, 10, Color.white, true); this.isDestroyed = false; }
public Creep(Vector2f initPos, Color color){ hp = 100; shape = new Rectangle(0, 0, WIDTH, HEIGHT); shapeFill = new GradientFill(0,0, color, 20, 20, color, true); position = initPos; direction = new Vector2f(0, 0.01f*speed); shape.setLocation(position); isDestroyed = false; }
public void init(Vector2f centerPos, Stats stats){ this.stats = stats; position = new Vector2f(centerPos.x - WIDTH/2, centerPos.y - HEIGHT/2); shape = new Polygon(new float[]{position.x, position.y, position.x + WIDTH/2, position.y - HEIGHT, position.x + WIDTH, position.y}); shape.setLocation(position); Color color = ColorSwitch.getColorFromId(id); shapeFill = new GradientFill(0,0, color, 50, 50, color, true); direction = new Vector2f(0,0); gun = new Gun(); moveTo = null; creeps = new HashMap<Integer, Creep>(); }
/** * Will draw a box that holds dialog * * @param g graphics to draw the box with */ public void drawDialogBox(Graphics g) { // x: 20 y: 470 width: 960 height: 640 - 470 // g.drawRect(20, 470, 960, 170); g.fill(new Rectangle(20, 470, 960, 170), new GradientFill(20f, 470f, transparentGrey, 980f, 660f, transparentGrey)); }