import processing.core.PApplet; import processing.core.PFont; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.Arrays; /** * The window which holds all game information and draws. */ public class Fenster extends PApplet { Player player; Tiles tiles; float tilewidth = 40.0f; // STATES StartScreen startScreen; GameScreen gameScreen; FightScreen fightScreen; DeathScreen deathScreen; boolean gametitel = true; Fight myfight; AuraFight auraFight; int gametitel_gamma = 255; boolean gametitel_fade = false; UI ui = new UI(this); @Override public void settings() { size(800, 800); classSetup(); tiles.settings(); //this.text("lol", 0, 0); //this.rect(4.0f, 4.0f, 4.0f, 4.0f); } @Override public void setup() { PFont font = createFont("UbuntuMono Nerd Font Mono Bold", 18); this.textFont(font); this.textSize(20); this.textAlign(CENTER, CENTER); myfight = new Fight(this, player, (Enemy) tiles.get(10, 10)); startScreen.setup(); startScreen.isState = true; } @Override public void draw() { System.out.println(frameRate); if(!startScreen.draw()) { if(!gameScreen.active() && !fightScreen.active()) { gameScreen.isState = true; } } gameScreen.draw(); fightScreen.draw(); deathScreen.draw(); if (gametitel) { fill(color(49, 54, 63), gametitel_gamma); rect(0, 0, 800, 800); textSize(15); fill(color(238, 238, 238), gametitel_gamma); text(" ('-. _ .-') ('-. (`\\ .-') /` _ .-') _ .-') _ \n" + " ( OO ).-. ( \\( -O ) ( OO ).-. `.( OO ),' ( \\( -O ) ( ( OO) ) \n" + " / . --. / ,--. ,--. ,------. / . --. /,--./ .--. .-'),-----. ,------. ,--. \\ .'_ \n" + " | \\-. \\ | | | | | /`. ' | \\-. \\ | | | ( OO' .-. '| /`. ' | |.-') ,`'--..._) \n" + ".-'-' | | | | | .-') | / | |.-'-' | || | | |, / | | | || / | | | | OO )| | \\ ' \n" + " \\| |_.' | | |_|( OO )| |_.' | \\| |_.' || |.'.| |_)\\_) | |\\| || |_.' | | |`-' || | ' | \n" + " | .-. | | | | `-' /| . '.' | .-. || | \\ | | | || . '.'(| '---.'| | / : \n" + " | | | |(' '-'(_.-' | |\\ \\ | | | || ,'. | `' '-' '| |\\ \\ | | | '--' / \n" + " `--' `--' `-----' `--' '--' `--' `--''--' '--' `-----' `--' '--' `------' `-------'", 400, 200); if (gametitel_fade) { gametitel_gamma = gametitel_gamma - 5; } if (gametitel_gamma < 1) { gametitel = false; } } //println(player.x + " " + player.y); } public void keyPressed(processing.event.KeyEvent event) { if (gametitel) { if (keyCode == 32) { gametitel_fade = true; } } if (key == 'w') { dead(); } startScreen.keyPressed(); gameScreen.keyPressed(); fightScreen.keyPressed(); } public void mousePressed() { fightScreen.mousePressed(); deathScreen.mousePressed(); } void classSetup() { player = new Player(this); tiles = new Tiles(this, 40.0f); startScreen = new StartScreen(this); gameScreen = new GameScreen(this); fightScreen = new FightScreen(this); deathScreen = new DeathScreen(this); } public void dead() { gameScreen.isState = false; fightScreen.isState = false; deathScreen.isState = true; } public void reset() { classSetup(); deathScreen.isState = false; startScreen.setup(); tiles.settings(); startScreen.isState = true; } }