public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { Instructions.draw(0, 0); move.draw(450, 120); slash.draw(450, 200); baddy.draw(450, 300); if (slash.getFrame() == 1) { g.drawImage(new Image("res/Link/Sword (right 2).png"), 490, 200); } }
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { // throws=nicht um Exception kümmern Image unscaledBackground = new Image("res/Pics/background.jpg"); background = unscaledBackground.getScaledCopy(0.6f); schriftSchwarz = new AngelCodeFont( "res/Fonts/TakeCoverSchwarz.fnt", new Image("res/Fonts/TakeCoverSchwarz.png")); schriftRot = new AngelCodeFont("res/Fonts/TakeCover.fnt", new Image("res/Fonts/TakeCover.png")); menüSchriftStart = schriftSchwarz; menüSchriftOptionen = schriftSchwarz; menüSchriftCredits = schriftSchwarz; this.titelPosition(); // Achtung Image = null!!! startKnopf = new MouseOverArea( gc, null, xtitle1, ytitle1, menüSchriftStart.getWidth("START"), menüSchriftStart.getHeight("START")); optionenKnopf = new MouseOverArea( gc, null, xtitle2, ytitle2, menüSchriftStart.getWidth("OPTIONEN"), menüSchriftStart.getHeight("OPTIONEN")); creditsKnopf = new MouseOverArea( gc, null, xtitle3, ytitle3, menüSchriftStart.getWidth("CREDITS"), menüSchriftStart.getHeight("CREDITS")); knopfGedrueckt = new Sound("res/Sounds/button-29.ogg"); }
/** * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer, * org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics) */ public void render(GameContainer container, StateBasedGame game, Graphics g) { // Hintergrund rendern background.draw(0, 0); g.setFont(font); g.setColor(Color.white); g.drawString("GAME PAUSED", container.getWidth() / 2 - (font.getWidth("GAME PAUSED") / 2), 180); for (int i = 0; i < options.length; i++) { g.setColor(Color.white); if (selected == i) { g.setColor(Color.red); // g.drawRect(200, 390 + (i * 50), 400, 50); } g.drawString(options[i], 400 - (font.getWidth(options[i]) / 2), 230 + (i * 50)); } }