diff --git a/readme.org b/readme.org index 1abe73f..71fd93d 100644 --- a/readme.org +++ b/readme.org @@ -10,10 +10,10 @@ *** DONE Zombies random spawn *** TODO reales level vllt https://limezu.itch.io/modernexteriors -** TODO Persistierung des Spielstandes (abspeichern) +** DONE Persistierung des Spielstandes (abspeichern) *** DONE only 1 save or pick save only one save -*** TODO dont show full intro when save exists +*** DONE dont show full intro when save exists * Dokumentation ** TODO Kurze Präsentation (10 min) im letzten Labortermin (eine pro Gruppe) ** DONE JavaDoc-Dokumentation @@ -21,3 +21,8 @@ only one save * Spaß ** level system +** Save points +** Zombies follow +** Something to do with levels +** Minimap of some sort +** Better start screen diff --git a/src/Character.java b/src/Character.java index f4d076c..a894383 100644 --- a/src/Character.java +++ b/src/Character.java @@ -9,9 +9,8 @@ public class Character implements Drawable { int color; boolean collidable; Position pos; - int experience = 0; - int level = 1; - float damage_mult = (float) (1 + level * 0.4); + + int textsize = 20; Character (Fenster window, String type) { diff --git a/src/Fenster.java b/src/Fenster.java index 5c1d510..ccbb6dd 100644 --- a/src/Fenster.java +++ b/src/Fenster.java @@ -112,11 +112,10 @@ public class Fenster extends PApplet { gameScreen.draw(); fightScreen.draw(); - deathScreen.draw(); - popMatrix(); ui.draw(); + deathScreen.draw(); if (gametitel) { fill(color(49, 54, 63), gametitel_gamma); rect(0, 0, 800, 800); diff --git a/src/Fightable.java b/src/Fightable.java index fb6ea8e..108789b 100644 --- a/src/Fightable.java +++ b/src/Fightable.java @@ -1,4 +1,7 @@ public abstract class Fightable extends Character { + int experience = 0; + int level = 1; + float damage_mult = (float) (1 + level * 0.4); public Fightable(Fenster window) { super(window); diff --git a/src/Player.java b/src/Player.java index bf9a51b..31c48a7 100644 --- a/src/Player.java +++ b/src/Player.java @@ -9,8 +9,10 @@ import java.util.List; */ public class Player extends Fightable implements Health { int health; + int maxHealth = 20; + List skills = new ArrayList(); Skill skill = new Tritt(window, this); @@ -46,4 +48,17 @@ public class Player extends Fightable implements Health { health = maxHealth; } } + + private void level_sync() { + level = experience/100; + } + public void draw() { + if (window.gameScreen.active()) { + pos.sync_grid(); + } + level_sync(); + window.fill(color); + window.textSize(textsize); + window.text(type, pos.get().x, pos.get().y); + } } diff --git a/src/Skill.java b/src/Skill.java index 2a8f4ba..9629efa 100644 --- a/src/Skill.java +++ b/src/Skill.java @@ -3,8 +3,8 @@ */ public class Skill { Fenster window; - Character user; - Character target; + Fightable user; + Fightable target; static int power = 5; int numPoints = 10; diff --git a/src/Talkable.java b/src/Talkable.java index 9007d0f..3d7f654 100644 --- a/src/Talkable.java +++ b/src/Talkable.java @@ -5,12 +5,19 @@ import processing.core.PApplet; */ public class Talkable extends Character implements Interactable{ Bubble bubble; + boolean healme = false; Talkable (Fenster window, String type, int color, boolean collidable, Bubble bubble) { super(window, type, color, collidable); this.bubble = bubble; } + + Talkable (Fenster window, String type, int color, boolean collidable, Bubble bubble, boolean healme) { + super(window, type, color, collidable); + this.bubble = bubble; + this.healme = healme; + } Talkable(Talkable another) { super(another); } @@ -21,8 +28,10 @@ public class Talkable extends Character implements Interactable{ public void interact() { if(!this.bubble.toggle()) { - window.player.heal(20); - window.healEffect.play(); + if (healme) { + window.player.heal(20); + window.healEffect.play(); + } } } diff --git a/src/Tiles.java b/src/Tiles.java index c10be78..3b2bc4c 100644 --- a/src/Tiles.java +++ b/src/Tiles.java @@ -11,6 +11,7 @@ public class Tiles implements Drawable { Cell[][] tileMap; float tilewidth; Talkable old_dude; + Talkable item; Random rand = new Random(); @@ -31,7 +32,8 @@ public class Tiles implements Drawable { } void settings() { - old_dude = new Talkable(window, "T", window.color(20,20,200), true, new Bubble(window, Arrays.asList("Hey Junge!", "Was machst du hier unten?", "Lass mich dich heilen..."))); + old_dude = new Talkable(window, "T", window.color(20,20,200), true, new Bubble(window, Arrays.asList("Hey Junge!", "Was machst du hier unten?", "Lass mich dich heilen...")), true); + item = new Talkable(window, "?", window.color(20,20,200), true, new Bubble(window, Arrays.asList("You found an item", "There is probably nothing", "you can do with it right now..."))); tileMap = new Cell[100][100]; for(int i = 0; i < tileMap.length; i++) { @@ -63,6 +65,8 @@ public class Tiles implements Drawable { tileMap[30][30].character = old_dude; tileMap[10][10].character = new Enemy(window); + + tileMap[rand.nextInt(50)][rand.nextInt(50)].character = item; } /** diff --git a/src/UI.java b/src/UI.java index 945e7a6..16858a0 100644 --- a/src/UI.java +++ b/src/UI.java @@ -12,8 +12,12 @@ public class UI { } private void bottomBar(float x, float y) { + window.textSize(20); + window.fill(255); window.rectMode(window.CENTER); window.rect(x, 775, 300, 50); + exp(window.player.experience, window.player.level, x, 780); + healthBar(x, 760, window.player.health, window.player.maxHealth); } public void healthBar(float x, float y, int health, int maxHealth) { @@ -26,13 +30,14 @@ public class UI { window.rect(x - barlength/2, y, healthLength, 5); } - public void exp(int exp) { - window.text(exp, 50, 100); + public void exp(int exp, int level, float x, float y) { + window.fill(0); + window.text("exp " + exp + " level " + level, x, y); } public void draw() { bottomBar(400, 700); - healthBar(50, 50, window.player.health, window.player.maxHealth); - exp(window.player.experience); + + } }