import processing.core.PApplet; import processing.core.PFont; import processing.sound.*; 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; SoundFile soundTrack; SoundFile confirm; SoundFile enemyDamage; SoundFile playerDamage; SoundFile healEffect; SoundFile shrinkEffect; SoundFile noHit; SoundFile deathSound; SoundFile restart; boolean gametitel = true; Fight myfight; AuraFight auraFight; int gametitel_gamma = 255; boolean gametitel_fade = false; UI ui = new UI(this); public static void main(String[] args){ String[] processingArgs = {"auraworld"}; Fenster mySketch = new Fenster(); PApplet.runSketch(processingArgs, mySketch); } @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; soundTrack = new SoundFile(this, "./soundtrack.mp3"); soundTrack.loop(1, 0.2f); confirm = new SoundFile(this, "./assets/Text 1.wav"); enemyDamage = new SoundFile(this, "./assets/Hit damage 1.wav"); playerDamage = new SoundFile(this, "./assets/Boss hit 1.wav"); healEffect = new SoundFile(this, "./assets/Big Egg collect 1.wav"); shrinkEffect = new SoundFile(this, "./assets/Balloon start riding 2.wav"); noHit = new SoundFile(this, "./assets/Bubble 1.wav"); deathSound = new SoundFile(this, "./assets/Block Break 1.wav"); restart = new SoundFile(this, "./assets/Cancel 1.wav"); } @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() { soundTrack.stop(); deathSound.play(); gameScreen.isState = false; fightScreen.isState = false; deathScreen.isState = true; } public void reset() { classSetup(); soundTrack.play(); deathScreen.isState = false; startScreen.setup(); tiles.settings(); startScreen.isState = true; } }